[英]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? 我想知道是否可以配置RabbitMQ在将消息放置在另一个(主题)交换中一段时间后将其移动到DLX而不传递到任何队列并消耗掉吗?
All examples I've seen require that a queue exist, because the DLX mapping must be declared on the queue. 我见过的所有示例都要求一个队列存在,因为DLX映射必须在该队列上声明。 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#. FWIW,我正在使用C#中的RabbitMQ。
[UPDATE] [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. 我发现有一篇文章似乎建议我除了DLX之外还需要建立一种称为备用交换的东西,因为DLX仅接收已经路由的消息。 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. 声明主交换时,可以提供
alternate exchange
的名称作为参数。
alternate exhange
and make it of type fanout
. alternate exhange
并将其设置为fanout
类型。 Now all unrouted messages should end up in that queue. 现在,所有未路由的消息应最终在该队列中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.