srinath
srinath

Reputation: 2998

Multiple Queues with same binding key and one consumer

I have a scenario as below

enter image description here

Exchange is of type "topic" and i have two queues(queue1 and queue2) binded to it with routing key #.

Each queue is having 1 consumer. Now, when i send a message from publisher both queues are getting my message since its binded to routing key # .

Is there any way, we can send messages to only one queue on round robin basis ?

Since, each message is getting into both queues , i am getting duplication of messages.

Upvotes: 1

Views: 5359

Answers (1)

Gabriele Santomaggio
Gabriele Santomaggio

Reputation: 22712

If you are looking for round robin consuming you shoud see this pattern:

https://www.rabbitmq.com/tutorials/tutorial-two-java.html

So basically you publish to one queue and then you add consumers to the same queue.

through the QoS = 1 you have the round-robin. In this way you can add more consumers without create new queues

Upvotes: 1

Related Questions