Amazon Simple Queue Service
Developer Guide (API Version 2011-10-01)
Print this pageEmail this pageGo to the ForumsView the PDFShare this page on TwitterShare this page on FacebookBookmark this page on DeliciousSubmit this page to RedditSubmit this page to DiggDid this page help you?  Yes  No   Tell us about it...

Message Lifecycle

The following diagram and process describe the lifecycle of an Amazon SQS message, called Message A, from creation to deletion. Assume that a queue already exists.

Message Lifecycle

Message Lifecycle

Component 1 sends Message A to a queue and the message is redundantly distributed across the SQS servers.

When Component 2 is ready to process a message, it retrieves messages from the queue, and Message A is returned. While Message A is being processed, it remains in the queue and is not returned to subsequent receive requests for the duration of the visibility timeout.

Component 2 deletes Message A from the queue to avoid the message being received and processed again once the visibility timeout expires.

[Note]Note

SQS automatically deletes messages that have been in a queue for more than maximum message retention period. The default message retention period is 4 days. However, you can set the message retention period to a value from 60 seconds to 1209600 seconds (14 days) with SetQueueAttributes.