RabbitMQ消息在主题队列的ttl到期时没有死信

时间:2015-02-24 02:00:36

标签: rabbitmq ttl dead-letter rabbitmq-exchange

我有以下配置

{"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

一切都适用于另一个队列,它绑定到另一个交换(直接);发送到 consumer.exchange (主题)的邮件不会移动到DLX。我尝试使用DLX的路由键绑定但没有任何效果。 DLX上有关主题变更的任何问题吗?

由于

1 个答案:

答案 0 :(得分:0)

我解决了在DLX上再创建一个绑定到 consumer.topic2 的DL队列