RabbitMQ

Dead Letter Exchanges (DLX)

Capture messages that fail, expire, or overflow instead of losing them or looping forever.

A Dead Letter Exchange is where RabbitMQ sends messages that cannot be delivered normally. A message is dead-lettered in three situations: it is rejected/nacked with requeue=false, it exceeds its TTL, or the queue exceeds its length limit. Configuring a queue with x-dead-letter-exchange reroutes such messages to the DLX, which delivers them to a dead-letter queue for inspection, alerting, or retry.

An undeliverable-mail office: letters that bounce, expire, or overflow the mailbox are not thrown away but collected in a dead-letter room where staff investigate, fix the address, and re-send.

Key Concepts

1
This is the foundation of robust error handling. A poison message (one that always fails) would otherwise loop forever if requeued; sending it to a DLX after N attempts isolates it for a human or a separate recovery process. The original message is preserved along with headers describing why and how often it was dead-lettered.
2
A common pattern combines DLX with TTL to build delayed retries: messages sit in a wait queue with a TTL, then dead-letter back to the work queue after the delay.