0
votes

I have a publish-subscribe scenario built using 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?

2) If both are possible, which one is better?

3) Since there are multiple parties involved, producer and multiple consumers, who should handle the dead letters. 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.

1

1 Answers

1
votes

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.
  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. So, yes, it's generally a consumer-side configuration.