M
M
Maxim2016-08-05 12:36:25
RabbitMQ
Maxim, 2016-08-05 12:36:25

How to properly organize routing in rabbitmq?

Hey!
I need to use rabbit to organize the following scheme.
I have N servers ( in my case server = customer ) logically divided into groups ( A / B / C / D / etc ).
Each message must be delivered to all servers of the corresponding group.
A-message -> all A-customers, B -> B and so on.
I have created an exchange with a fanout type named exchange_A and queue_A, expecting messages to be sent to each customer A-1, A-2 and A-3.
3b728c4c05e344119f465a2720e60335.png
The result was not what I expected - messages came to each server in the group in turn.
Because fanout is not about the customer, but about the queue. And judging by the description of the protocol, this is exactly how it should be.
Customer took the message, rabbit removed it from the queue, no one will see this message again.
Right now, my scheme looks like this: a separate queue is created for each customer, into which messages come from the broadcast exchange point. But I still need to send messages not to all queues but to groups. As a result, such a scheme was born.
38083587514d49b38f2d332586bf5177.png
The question is this.
Is it normal practice to create a queue for each customer? Or is there a better solution than in the last picture?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
napa3um, 2016-08-06
@usbmonkey

Fine. Separate queues for each consumer are needed to guarantee delivery, otherwise it would not be clear to the broker when it is possible to remove a message from the general queue (whether all consumers took it). That is, the multiplication of one request to many consumers must be done in the application logic, and not in the broker's logic (the application must know about the configuration of the roles of all consumers, and the broker does not need to know this).
stackoverflow.com/questions/10620976/rabbitmq-amqp...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question