简体   繁体   English

RabbitMq中每个消息使用者的单独死信队列

[英]Separate Dead Letter Queue for each Message Consumer in RabbitMq

I have a publish-subscribe scenario built using RabbitMQ. 我有一个使用RabbitMQ构建的发布-订阅方案。 There is an exchange where the messages are being sent by the publisher and any consumer subscribing to that exchange receives those messages in their respective queues. 在一个交易所中,发布者正在发送消息,而订阅该交易所的任何消费者都会在其各自的队列中接收这些消息。 This is a fanout scenario where there is a single producer but multiple consumers. 这是一个扇出方案,其中只有一个生产者,但有多个消费者。

Now I am willing to integrate a dead letter queue into the system so that the rejected messages can be handled later on. 现在,我愿意将一个死信队列集成到系统中,以便以后可以处理被拒绝的消息。 My questions are 我的问题是

1) Should I have a separate dead letter queue configured for each consumer or there should be a single one to handle all rejected messages from all the consumers? 1)我应该为每个使用者配置一个单独的死信队列,还是应该有一个单独的死信队列来处理来自所有使用者的所有拒绝邮件?

2) If both are possible, which one is better? 2)如果两者都可行,哪个更好?

3) Since there are multiple parties involved, producer and multiple consumers, who should handle the dead letters. 3)由于涉及多个方,生产者和多个消费者,他们应该处理这些死信。 Will it be the producer or each consumer will handle its own dead letter in its own way? 是生产者还是每个消费者将以自己的方式处理自己的死信?

4) Just to confirm dead letter queues should always be configured with consumer queues rather than the producer queue or producer exchange. 4)只是为了确认死信队列,应始终使用使用者队列而不是生产者队列或生产者交换来配置。

The answers will all depend on your requirements. 答案将完全取决于您的要求。

  1. It depends on how you handle your dead letter messages - if you use a single queue, you can find the origin information in the x-death header. 这取决于您处理死信的方式-如果使用单个队列,则可以在x-death标头中找到原始信息。
  2. "Better" is subjective - it entirely depends on what you want to do. “更好”是主观的-完全取决于您想做什么。
  3. Again, it's up to you and your application design. 同样,这取决于您和您的应用程序设计。
  4. > ...producer queue... Producers don't know about queues - only exchanges and (often) routing keys. > ...producer queue...生产者不了解队列-仅交换和(通常)路由键。 So, yes, it's generally a consumer-side configuration. 因此,是的,它通常是用户端配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM