receiveRequestAttemptId
This parameter applies only to FIFO (first-in-first-out) queues.
The token used for deduplication of ReceiveMessage calls. If a networking issue occurs after a ReceiveMessage action, and instead of a response you receive a generic error, it is possible to retry the same action with an identical ReceiveRequestAttemptId to retrieve the same set of messages, even if their visibility timeout has not yet expired.
You can use
ReceiveRequestAttemptIdonly for 5 minutes after aReceiveMessageaction.When you set
FifoQueue, a caller of theReceiveMessageaction can provide aReceiveRequestAttemptIdexplicitly.It is possible to retry the
ReceiveMessageaction with the sameReceiveRequestAttemptIdif none of the messages have been modified (deleted or had their visibility changes).During a visibility timeout, subsequent calls with the same
ReceiveRequestAttemptIdreturn the same messages and receipt handles. If a retry occurs within the deduplication interval, it resets the visibility timeout. For more information, see Visibility Timeout in the Amazon SQS Developer Guide.If a caller of theReceiveMessageaction still processes messages when the visibility timeout expires and messages become visible, another worker consuming from the same queue can receive the same messages and therefore process duplicates. Also, if a consumer whose message processing time is longer than the visibility timeout tries to delete the processed messages, the action fails with an error.To mitigate this effect, ensure that your application observes a safe threshold before the visibility timeout expires and extend the visibility timeout as necessary.While messages with a particular
MessageGroupIdare invisible, no more messages belonging to the sameMessageGroupIdare returned until the visibility timeout expires. You can still receive messages with anotherMessageGroupIdfrom your FIFO queue as long as they are visible.If a caller of
ReceiveMessagecan't track theReceiveRequestAttemptId, no retries work until the original visibility timeout expires. As a result, delays might occur but the messages in the queue remain in a strict order.
The maximum length of ReceiveRequestAttemptId is 128 characters. ReceiveRequestAttemptId can contain alphanumeric characters (a-z, A-Z, 0-9) and punctuation (!"#$%&'()*+,-./:;<=>?@[\]^_{|}~`).
For best practices of using ReceiveRequestAttemptId, see Using the ReceiveRequestAttemptId Request Parameter in the Amazon SQS Developer Guide.