DLQ (dead letter queue)
A dead letter queue (DLQ) is a separate queue or topic where a messaging system moves messages that cannot be processed after a set number of attempts. It stops one bad message, often called a poison message, from blocking or endlessly retrying in the main queue. Engineers inspect the DLQ later, fix the cause and replay the messages.
How it works
The consumer tries a message and fails. The broker or client library redelivers it until it reaches a limit, such as maxReceiveCount in Amazon SQS or MaxDeliver in NATS JetStream. Then it moves the message to the DLQ, usually with the error and attempt count attached. For example, with a limit of 5, a message with malformed JSON fails five times and moves aside, while the other 10,000 messages that minute flow on.
Why it matters in production
Without a DLQ, a poison message either blocks an ordered partition or is dropped silently. With one, failures become visible and recoverable. Alert when DLQ depth rises above zero, and keep its retention long enough to replay, since an SQS queue keeps messages for at most 14 days.
See also
On the One2N blog
Deploying a scalable NATS cluster part 1: core architecture and considerations
Shooting ourselves in the foot by enabling Spring Kafka batching
Further reading
