Using Dead Letter Queue in AWS SQS

A useful feature in message queuing system

Dead letter queue is a very useful feature in message queuing systems. By using this feature, we can automatically transfer messages, that have exceeded the maximum number of receiving message, to the dead letter queue.

In many cases, messages that have exceeded threshold mean that we failed to handle them. For example, messages with a different format from expectations, messages with missing required items, and so on. We should transfer such messages to another queue and investigate the cause of the failure later. The main purpose of using Dead letter queue is this.

OK, let’s try to use Dead letter queue in AWS SQS.

  1. Create two queues: “my-test-queue” and “my-test-dead-letter-queue”

2. Configure my-test-queue to use my-test-dead-letter-queue as its dead letter queue

3. Send a message to my-test-queue

4. View the message in my-test-queue

The receive count is 1

5. View it again

The receive count is 2

6. View it once again

The receive count is 3

6. Try to view it once again, confirmed that message is gone!

7. View the message in my-test-dead-letter-queue


As above, it’s easy to use Dead letter queue in SQS. You can read more details in the SQS document.