Search code examples
amazon-web-servicesaws-lambdaamazon-sqs

How does a message get deleted from an AWS Dead Letter Queue (DLQ)?


I am working with AWS SQS Dead Letter Queues (DLQ) and trying to understand how messages are removed from the DLQ.

Scenario:

  • I have regular SQS Queue A and DLQ B and Lambda C.
  • Lambda C gets invoked by a message on SQS Queue.
  • Let say for whatever reason if something happens to Lambda C then message from SQS Queue A moves to DLQ B.
  • Then same Lambda C is invoked by message from DLQ B.

My Questions:

  • Let say if Lambda C is still not responding then what happens to message on DLQ B?
  • For how long that message will stay on DLQ B?
  • If Lambda C reads message from DLQ B then do i need to manually delete that message from DLQ B or it automatically gets deleted?

What I've Tried:

Checking AWS documentation on SQS DLQ but couldn't find a clear explanation regarding message deletion. Exploring AWS SDK methods like deleteMessage() to manually remove messages. How does message deletion work in AWS DLQs? Is there a best practice for handling messages in the DLQ efficiently?


Solution

  • A DLQ is just another SQS queue, with the same settings and behavior as any other SQS queue. SQS queues have a configurable message retention period of up to 14 days. The messages would eventually be deleted once they were in the DLQ past the configured retention period for your DLQ.