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

雨燕双飞 提交于 2019-11-27 08:33:16

问题


I am trying to achieve this. There are so many conflicting answers to know if its possible or not.

According to previous link, it is not possible. But in another question on this forum, somebody remarked that they were able to here and in the comment section here.

So, Is it possible to do live queue => dead-letter-queue => live queue

Or do I need to use a particular version of RabbitMq to achieve this ?

I am able to do: live queue => dead-letter-queue and dead-letter-queue => live queue.


回答1:


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.



来源:https://stackoverflow.com/questions/27640358/spring-amqp-with-rabbitmq-message-is-not-circled-back-to-live-queue-after-falli

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