Home > OS >  Do failed SQS messages have a visibility timeout?
Do failed SQS messages have a visibility timeout?

Time:03-09

Let's say that a SQS message was consumed by a consumer, and within the visibility timeout, the consumer gave an error. Now the SQS will try to retry the message, so will that be done after the current visibility timeout of the message completes, or will it be done ASAP?

CodePudding user response:

When a message is retrieve from an Amazon SQS queue using ReceiveMessage(), the message(s) will be marked as invisible.

When the worker finishes processing the message, it should call DeleteMessage(), passing the ReceiptHandle of the message(s).

If the SQS queue does not receive a DeleteMessage() request within the timeout period, then the message(s) will reappear on the queue for processing.

Amazon SQS does not know when a "consumer gave an error". All it knows is whether an API call was made to SQS to delete the message, or to ask for the invisibility period to be extended. (This is slightly different if SQS is being accessed by AWS Lambda, but I will assume this is not the case in your situation.)

  • Related