Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi producer, multi consumer in Rabbit MQ with single queue

I'm very new to RabbitMQ and I need to write a program that has Multi Producer and multi consumer with a single queue. Is this possible to do what I've shown in the image? I found lots of examples but they are all with single producer. Any producer send messages to any consumer.

enter image description here

like image 279
Diana Avatar asked Dec 16 '14 10:12

Diana


People also ask

Can a queue have multiple consumers in RabbitMQ?

In RabbitMQ, we can have multiple consumers listening from one queue. This is good for fast procesing, but not so good for message ordering.

Can you have multiple subscriptions on a single message RabbitMQ queue?

It is not possible.

Can RabbitMQ have multiple producers?

Multiple producers can publish to the same exchange - or directly to a single queue via the built-in direct exchange. You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.

Can a queue have multiple consumers?

Support for multiple-consumer queues is a Message Queue feature (the JMS specification defines messaging behavior in the case of only one consumer accessing a queue). When multiple consumers access a queue, the load-balancing among them takes into account each consumer's capacity and message processing rate.


1 Answers

In short, the answer is absolutely you can have many producers that publish to a single queue. I would recommend that you create an exchange and have your producers send things into an exchange which then forwards to a queue. In your simple diagram an exchange is not strictly necessary but it makes your solution more extensible in the future.

like image 81
jhilden Avatar answered Nov 15 '22 04:11

jhilden