[rabbitmq-discuss] there is a Consumer connected?

Alexander Ward alexander.ward at quibids.com
Mon Jun 11 15:37:30 BST 2012


You can also check to see if a queue exists by doing a passive declare.
Since your queue is non-durable, if there are no consumers connected to it,
it won't exist.

To answer Simon's question, I do this in order to route requests to a
specific machine/consumer cluster by declaring a queue with the name of the
machine which is consuming. I check to see if the queue exists first, and
if it does, I route the message to that queue (where there may be multiple
consumers on it), otherwise I send it to a general queue which is durable.
Essentially I'm using it to partition tasks based on their hardware/network
needs.

Cheers,
-Alex

On Mon, Jun 11, 2012 at 5:10 AM, Simon MacMullen <simon at rabbitmq.com> wrote:

> On 10/06/12 21:38, Yurisleidy Hernández Moya wrote:
>
>> The Producer can know if there is a Consumer connected to the queue
>> before sending the message?
>>
>
> To answer your question literally: yes, use the mgmt HTTP API.
>
> To answer your question slightly less literally, the point of a messaging
> system is to let producers and consumers become decoupled - why do you want
> the producer to know if there is a consumer around?
>
> Cheers, Simon
>
> --
> Simon MacMullen
> RabbitMQ, VMware
> ______________________________**_________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.**rabbitmq.com<rabbitmq-discuss at lists.rabbitmq.com>
> https://lists.rabbitmq.com/**cgi-bin/mailman/listinfo/**rabbitmq-discuss<https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120611/88a62344/attachment.htm>


More information about the rabbitmq-discuss mailing list