Message Lifecycle

The following diagram and steps 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 4 days.