Spring amqp with RabbitMq: Message is not circled back to live queue after falling off dead letter queue

荒凉一梦 提交于 2019-11-28 14:25:39

You can't do it if the dead-lettering from alive is due to expiry - according to the documentation...

It is possible to form a cycle of dead-letter queues. For instance, this can happen when a queue dead-letters messages to the default exchange without specifiying a dead-letter routing key. Messages in such cycles (i.e. messages that reach the same queue twice) will be dropped if the entire cycle is due to message expiry.

(my emphasis).

I just ran a test where the dead-lettering from alive is due to rejection and it works just fine; after a few cycles, the x-death header looks like this...

reason: rejected
queue:  alive
time:   1419448981
exchange:   req
routing-keys:   alive

reason: expired
queue:  dead
time:   1419448981
exchange:   dlx
routing-keys:   alive

reason: rejected
queue:  alive
time:   1419448976
exchange:   req
routing-keys:   alive

reason: expired
queue:  dead
time:   1419448976
exchange:   dlx
routing-keys:   alive

...

To test this, I forced a failure in the Spring AMQP listener and set defaultRequeueRejected to false.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!