简体   繁体   中英

RabbitMQ: Move a message to DLX when there are no queues in the original exchange

I'm wondering whether it is possible to configure RabbitMQ to move a message to a DLX after it's been sitting in another (topic) exchange for a period of time without being delivered to any queue and consumed?

All examples I've seen require that a queue exist, because the DLX mapping must be declared on the queue. But what if there is no queue?

In my case, clients declare auto-delete queues that go away when the client closes the connection. This causes a problem for the publisher on the topic exchange, which is never notified that the message isn't likely to be consumed in the time allotted.

FWIW, I'm using RabbitMQ from C#.

[UPDATE]

I found an article that seems to suggest I need to set up something called an alternate exchange in addition to a DLX, because DLX only receives messages that have already been routed. I'm currently trying to understand how it's supposed to work.

Further suggestions are appreciated!

Take a look at alternate exchange docs article

When declaring main exchange, you can provide the name of alternate exchange as parameter.

  • Create the alternate exhange and make it of type fanout .
  • Create a single durable queue bound to that alternate exchange.

Now all unrouted messages should end up in that queue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM