Amazon Simple Queue Service
Developer Guide (API Version 2012-11-05)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did 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

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.