python - How to get SNS published message -
i have application publishes messages via amazon sns specified target. need message somehow using python. simplest way it?
amazon sns not directly allow messages retrieved. rather, given topic in amazon sns, configure subscribers. subscribers can be, example, email address, amazon sqs queue, http endpoint or few other options. see https://aws.amazon.com/sns/faqs/ (search "how amazon sns work") overview of how works.
using sqs queue
to receive published python script, best bet setup new amazon sqs queue script, , subscribe queue sns topic.
you can poll sqs queue see if there messages in queue.
this technique has advantage won't miss messages if python script not running - waiting there in sqs queue.
boto great python library interracting amazon, , this tutorial explains how access sqs queue.
using http endpoint
alternatively, if can deploy python script web application http endpoint api, can subscribe http endpoint sns topic, , endpoint invoked each time there new message. techique not recommended if script offline, miss messages.
Comments
Post a Comment