RabbitMQ 消费者是否可以配置为仅对同一消息使用定义的尝试次数
RabbitMQ 在某种程度上是否具有能力,我可以定义我的消费者,它具有消费相同消息的限制.即我的消费者使用 enqueue=true 进行基本拒绝.它会无限地继续收听相同的信息.我不是在谈论队列方面的 TTL.但是对消费者的控制/配置告诉我只想消费 5 次,然后将其发送到另一个队列.这可以实现吗?
Does RabbitMQ capable in a way, I can define my consumer that it has a limit of consuming the same message. i.e my consumer doing a basic Reject with enqueue=true. And it will infinitely keep on listening to the same message. I am not talking about TTL on the queue side. But a control/config over consumer to tell I want to consume this only 5 times and then send it to another queue for instance. Can this be achieved ?
推荐答案
这可以在应用程序级别或通过 TTL 和 死信交换.在代理方面没有你想要的方式(我认为你没有理由不能在消费者方面这样做)
This can be done on application level or via TTL and Dead Letter Exchanges. There is not known way to what you want on broker side (and I see no reason why you can't do that on consumer side)
P.S.:让评论更明显
主要思想是创建自定义 ttl 属性(TCP/IP 包中的 a-la 跃点计数)并在每次使用消息时减少它(并使用新属性重新发布消息体).当它达到零时 - 将其发布到其他队列.
The main idea is to create custom ttl property (a-la hops count in TCP/IP packages) and decrease it every time message been consumed (and re-publish message body with new props). When it reaches zero - publish it to other queue.
相关文章