David S
David S

Reputation: 13901

Release a message back to SQS

I have a some EC2 servers pulling work off of a SQS queue. Occasionally, they encounter a situation where the can't finish the job. I have the process email me of the condition. As it stands now, the message stays "in flight" until it times out. I would like for the process to immediately release it back to the queue after the email is sent. But, I'm not sure how to accomplish this. Is there a way? If so, can you please point me to the call or post a code snippet.

I'm using Python 2.7.3 and Boto 2.5.2.

Upvotes: 29

Views: 19844

Answers (1)

garnaat
garnaat

Reputation: 45906

If you have read a message and decide, for whatever reason, that you do not want to process it and would rather make it immediately available to other readers of the queue, you can simply set that message's visibility timeout to zero using the change_visibility method of the Message object in boto. See The SQS Developer's Guide for details.

Upvotes: 44

Related Questions