我正在努力实现this 。有很多相互矛盾的答案来知道它是否可能。
根据之前的链接,这是不可能的。但在这个论坛的另一个问题中,有人说他们能够here并在评论部分here 。
那么,是否可以进行实时队列=>死信队列=>实时队列
或者我需要使用特定版本的 RabbitMq 来实现此目的吗?
我能够做到:实时队列 => 死信队列 和死信队列=>活队列。
最佳答案
如果 alive
中的死信由于过期而无法执行 - 根据文档...
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.
(我的重点)。
我刚刚运行了一个测试,其中来自 alive
的死信是由于拒绝而导致的,并且效果很好;几个周期后,x-death
header 看起来像这样......
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
...
为了测试这一点,我在 Spring AMQP 监听器中强制失败,并将 defaultRequeueRejected
设置为 false
。
关于rabbitmq - Spring amqp 与 RabbitMq : Message is not circled back to live queue after falling off dead letter queue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27640358/