[rabbitmq-discuss] Help: how a publisher could know number of consumers

Pascal Dergane pascaldergane at gmail.com
Wed Dec 8 23:48:54 GMT 2010

I use rabbitmq java client 1.7 with corresponding server on linux (centOs)
I've got a publisher that post a message to an exchange "myExchange" with
routing Key "myRoutingKey" (direct mode).
My system has a few consumers (say 20), each one connected to the same
exchange "myExchange", binding with routing key "myRoutingKey", each
consumers connected with a specific queue ("queue1" for first consumer,
"queue2" for second, etc...).

I expect that each consumer will process the message, and after will deliver
a response to the publisher on the replyQueue.

How the publisher could know that there's 20 consumers subscribing to the
exchange when it publis the message?
The idea, is that the publisher should know the number of consumers (or
queues ) that bind the routingKey to know how many responses it will expect?
Could you explain to me how to do that or give me a java example ?

Other point, to assume high avaibility, I could have more than one consumer
on the same queue. In these case, all consumers connected to the same queue
have established a "direct" connexion to assume that only one consumer
subscribed to the same queue will process the message. In these case, the
publisher should get only one information (the number of distinct queues,
not the number of consumers on one queue).

Thank you in advance,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20101209/284fc7c7/attachment.htm>

More information about the rabbitmq-discuss mailing list