user764529
user764529

Reputation:

Receive SQS notification and POST to endpoint

I am receiving the following 'message' to an SQS queue:

{'DataID': '12322', 'Timestamp': '2014-01-01'}

How would I post this data to the endpoint http://example.com/receiver. For example, in python the equivalent of:

requests.post(
           url=http://example.com/receiver,
           data={'DataID': '12322', 'Timestamp': '2014-01-01'}
 )

Is there a way to automatically POST the contents of the message to an endpoint? If so, what would be the easiest way to do that?

Upvotes: 0

Views: 911

Answers (1)

E.J. Brennan
E.J. Brennan

Reputation: 46841

The easiest thing to do is to take the message and post it to directly to an SNS endpoint that is setup to do the posting for you. Adding a message to SNS is almost exactly the same as adding it to SQS.

http://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.html

You could either do the post yourself to SNS, or change the process upstream, i.e. change the process that is currently posting to SQS to post it to SNS instead. That SNS topic can then post to the endpoint AND also the existing SQS queue can recieve the message as well if that is required (using the fan out pattern).

Upvotes: 1

Related Questions