Smit Parmar
Smit Parmar

Reputation: 188

How to set max retries in SQS (dead-letter queues) on lambda timed out error?

How to delete message from DLQ when same kind of error keep repeating? for example lambda timed out after 15 minute of execution.

I've integrated SQS with lambda and attached DLQ. SO when lambda got timed out error then that message passed to DLQ. So now DLQ keep processing the message infinite time.

So my question is there any way to delete message after 2 retries from DLQ?

Upvotes: 0

Views: 1421

Answers (1)

Carlos Henrique Reis
Carlos Henrique Reis

Reputation: 107

The flow of the message sent by the producer to SQS is as follows:

  1. The producer application sends a message to an SQS queue
  2. The consumer application fails to process the message in the same SQS queue
  3. The message is moved from the main SQS queue to the default dead-letter queue as per the component settings.
  4. A Lambda function is configured with the SQS main dead-letter queue as an event source. It receives and sends back the message to the original queue adding a message timer.
  5. The message timer is defined by the exponential backoff and jitter algorithm.
  6. You can limit the number of retries. If the message exceeds this limit, the message is moved to a second DLQ where an operator processes it manually.

enter image description here

More info about implementation: https://aws.amazon.com/pt/blogs/compute/using-amazon-sqs-dead-letter-queues-to-replay-messages/

Upvotes: 1

Related Questions