I have tried to search my question for several days but found no satisfying solutions.
So here is my situation:
I have an application runs on different nodes, say 3. Each application on each of these 3 nodes needs to consume same messages.
How can I achieve this?
Below are some approaches I have tired :
- Binding 3 consumers/nodes to one queue. The problem is that RabbitMQ uses round-robin strategy to ensure load balance. So for each message there will be only one consumer.
Possible solution: Is there a way to turn off round-robin strategy ?
- Use FANOUT exchange.The problem is that we are using auto-deployment tools so the configuration for each nodes is totally the same, resulting in 3 consumers/nodes declare one same queue. This turn out to be the first failed approach above.
- Each application/nodes declares different queues with certain unique and random queue names, and bind these queues to a FANOUT exchange. The problem is when an application disconnects and reconnects with RabbitMQ, it will declare a new queue due to the random queue names, and fail to consume messages that piled up on the earlier queues during the disconnection time.
Thanks in advance for your replies.