We have a cluster of queues and exchanges to support a message.
Say I have a fanout “foo-exchange” which sends messages to queues “bar” and “baz”. Let’s say a message comes in, and it’s valid, and “bar” processes it successfully, but “baz” fails for some reason (maybe an external service is down) and we want to retry it after 5 minutes. The message from “baz” is sent to back to “foo-exchange” (via the delay queue) which then not only sends it back to “baz”, but “bar” as well.
We have an exchange per queue to send the retried message back to a specific queue after the retry timeout period.
In this scenario, we have 3 exchanges (“foo-exchange”, “foo-exchange-dead”, “Baz-exchange-retry (1 per queue to fanout exchange)” and 3 queues (“baz-queue”, “baz-queue-delay”, “baz-queue-error” and 1 dead queue for whole exchange (“foo-queue-dead).
This setup is for 1 queue to fanout and will increase considerably which a fanout exchange have multiple consumer queues.
So, we need a solution which can decrease this complex setup into some manageable queues and exchanges
Every queue is also bound to the default exchange ("") with the routing key equal to the queue name.
You can simply route your expired dead letters directly to the original queue.