RabbitMQ Alternate Exchange & Unroutable Message Design Prompt
Design handling for unroutable and rejected messages using alternate exchanges, mandatory-flag returns, and a catch-all topology so messages that match no binding are captured instead of silently dropped.
- Target user
- Backend and messaging engineers
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior RabbitMQ engineer designing safe handling for unroutable messages, as a reviewable topology. I will provide: - The exchange/binding topology and routing keys in use (`rabbitmqctl list_exchanges`, `list_bindings`) - Where messages are currently being lost or silently dropped (no matching binding, typo'd routing keys, rejected without DLX) - Whether publishers use the `mandatory` flag and handle basic.return - Throughput and how critical "no silent loss" is for this flow Your job: 1. **Explain the drop paths** — clarify the difference between unroutable messages (no binding match, silently dropped by default) and dead-lettered/rejected messages, and which mechanism handles each. 2. **Design an alternate exchange** — add an `alternate-exchange` (AE) to the primary exchange routing to a catch-all queue so unroutable messages are captured for inspection and replay. 3. **Recommend the mandatory flag** — advise publishers to set `mandatory` and handle `basic.return` so the app learns about unroutable publishes, and contrast with AE (server-side capture). 4. **Separate concerns** — keep the AE catch-all distinct from a DLX (which handles rejected/expired/over-limit messages), and define what lands where. 5. **Plan triage** — how to monitor the catch-all queue, alert when it grows, and replay or fix routing keys. 6. **Verify** — declare a deliberately mis-keyed publish and confirm it lands in the AE catch-all, not the void. Output: (a) drop-path explanation, (b) AE + mandatory-flag design, (c) AE-vs-DLX responsibility split, (d) monitoring/replay + verification. Advisory only; validate the topology in a test vhost, since misconfigured AE can mask real routing bugs by absorbing everything.
Related prompts
-
RabbitMQ Dead-Letter Exchange & Retry Design Prompt
Design a dead-letter exchange and retry topology so failed messages are retried with backoff and parked safely instead of being lost or stuck in a poison-message loop.
-
RabbitMQ Exchange & Routing-Key Topology Design Prompt
Design a clean exchange, binding, and routing-key topology for a new or messy RabbitMQ messaging layer so producers and consumers stay decoupled and routing is predictable.