Answer the question
In order to leave comments, you need to log in
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.
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.
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
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 questionAsk a Question
731 491 924 answers to any question