【发布时间】:2015-02-24 02:00:35
【问题描述】:
我有以下配置
{"rabbit_version":"3.4.3",
...
"queues":[
{"name":"consumer.queue-dl","vhost":"dev","durable":true,"auto_delete":false,"arguments":{}},
{"name":"consumer.queue","vhost":"dev","durable":true,"auto_delete":false,"arguments":{"x-message-ttl":1000,"x-dead-letter-exchange":"consumer.exchange-dl"}},
{"name":"another-queue", "vhost":"dev","durable":true,"auto_delete":false,"arguments":{"x-message-ttl":1000,"x-dead-letter-exchange":"consumer.exchange-dl"}},
],
"exchanges":[
{"name":"consumer.exchange-dl","vhost":"dev","type":"direct","durable":true,"auto_delete":false,"internal":false,"arguments":{}},
{"name":"consumer.exchange","vhost":"dev","type":"topic","durable":true,"auto_delete":false,"internal":false,"arguments":{}},
{"name":"another-exchange","vhost":"dev","type":"direct","durable":true,"auto_delete":false,"internal":false,"arguments":{}}
],
"bindings":[
{"source":"consumer.exchange-dl","vhost":"dev","destination":"consumer.queue-dl","destination_type":"queue","routing_key":"","arguments":{}},
{"source":"consumer.exchange-dl","vhost":"dev","destination":"consumer.queue-dl","destination_type":"queue","routing_key":"#","arguments":{}},
{"source":"consumer.exchange","vhost":"dev","destination":"consumer.queue","destination_type":"queue","routing_key":"consumer.topic2","arguments":{}},
{"source":"another-exchange","vhost":"dev","destination":"another-queue","destination_type":"queue","routing_key":"","arguments":{}}
]}
我在 anoter-queue 和 consumer.queue 上设置了 DLX,因此他们的消息会在 1 秒后移至 consumer.exchange-dl .
对于绑定到 another-exchange(直接)的 another-queue,一切正常;发送到 consumer.exchange(主题)的消息不会移动到 DLX。我尝试使用 DLX 的路由键绑定,但没有任何效果。在 DLX 上进行主题交换有什么陷阱吗?
谢谢
【问题讨论】:
标签: rabbitmq ttl dead-letter rabbitmq-exchange