Error when trying to read AWS SNS message

一曲冷凌霜 提交于 2019-12-07 02:10:27

Your function is calling rekognition.start_label_detection() (and presumably you have created the rekognition client in code not shown).

This API call starts label detection on a video. When it is finished, it will publish a message to the given SNS topic. You can connect a Lambda function to SNS to retrieve the details of the label detection when it is finished.

However, your code is getting the order of operations mixed up. Instead, you should be doing the following:

  • Something (probably not a Lambda function) should call start_label_detection() to begin the process of scanning the video. This can take several minutes.
  • A Lambda function should be configured to trigger when the SNS topic receives a message.
  • The Lambda function is then passed a copy of the message, which can be used to call get_label_detection() to retrieve the details of the scan.

So, your first step is to separate the initial start_label_detection() request from the code that retrieves the results. Then, modify the Lambda function to retrieve the results via get_label_detection() and process the results.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!