the first thing we need to do is to create a dead-letter exchange. This exchange will be used to route messages that are rejected by our application. Open RabbitGUI and go to the "Exchanges" menu and click on "New". Give it a name, for example events.dead-letter, and select the type fanout. This means that all messages sent to this exchange will be routed to all queues bound to it.

To avoid manually specifying the dead-letter exchange for each queue, we can create a policy that will automatically re-route rejected messages to our dead-letter exchange. Create a policy that is applied to all queues, and set the "Dead-letter exchange" to the one we just created (events.dead-letter). This way, all messages that are rejected by our application will be automatically routed to the dead-letter exchange.
To check that the policy is correctly applied, go to any queue in the settings tab and check that the policy is applied and the dead-letter exchange is set properly.

To learn more about debugging policies in RabbitMQ, read our article on debugging RabbitMQ policies.
We need to create a queue that will receive the messages that are rejected by our application. To do that, go to the "Queues" menu and click on "New". Give it a name, for example dlq.catch-all, and keep everything else empty.

This queue will have no consumer, it is only meant to store messages that are rejected. It is your job to later inspect this queue and decide what to do with the messages. You can re-publish them, delete them, or let them eventually die.
Now that all rejected messages are routed to the dead letter exchange, we need to bind the exchange to our queue. To do that go to the "Routing" tab of your queue and add a binding to the dead-letter exchange:

Since we created a fanout exchange, all messages will be routed to our queue regardless of their routing key. This is why RabbitGUI does not ask for a routing key when binding the exchange to the queue. This will have the benefit of preserving the existing message's routing key, which is useful if you want to re-publish them later.
RabbitGUI lets you easily manage dead-letter queues. You can filter messages, re-publish them, and even throttle the re-publishing process to avoid overwhelming your RabbitMQ server. Read more in our dedicated article on introspecting dead-letter queues with RabbitMQ. For retry and backoff before messages reach the DLQ, see the RabbitMQ retry pattern.
Search, filter and selectively republish dead-lettered messages in a few clicks, right from your desktop.
Fix my DLQs with RabbitGUIAvailable on Windows, Mac, and Linux.
RabbitMQ tutorialRabbitMQ default login and passwordThe default RabbitMQ username and password are guest / guest, and they only work from localhost. Learn how to log into the Management UI on port 15672, fix rejected logins, and set credentials in Docker.
RabbitMQ tutorialRabbitMQ exponential backoff: how to retry messages with increasing delaysHow to implement exponential backoff retries in RabbitMQ with TTL retry queues and dead-letter exchanges. Track attempts with an x-retry-count header, choose retry delays, and send final failures to a DLQ.
RabbitMQ tutorialWhat is AMQP? The Advanced Message Queuing Protocol explainedLearn what AMQP (Advanced Message Queuing Protocol) is, how it works, its core concepts, why it powers RabbitMQ, and how it compares to alternatives like MQTT, STOMP, and Kafka.
RabbitMQ tutorialBuilding an event bus with RabbitMQLearn how to design a decoupled event bus using a RabbitMQ topic exchange, with practical routing key conventions, durable queues, and animated diagrams showing message flow.
RabbitMQ tutorialRabbitMQ Retry Pattern: How to Retry Failed MessagesHow to retry failed messages in RabbitMQ without infinite requeue loops. Compare retry queues with TTL, exponential backoff and the delayed message exchange, cap retry attempts, and send final failures to a dead-letter queue.
RabbitMQ tutorialRabbitMQ exchange types explained: direct vs topic vs fanout vs headersLearn the 4 RabbitMQ exchange types: direct, fanout, topic and headers. See how routing keys work, when to use each exchange, and examples with animations.