[rabbitmq-discuss] Consumer

Yurisleidy Hernández Moya ymoya at uci.cu
Sat Jun 30 22:16:27 BST 2012


In the Producer I need to know if there are Consumers connected to the queue or not, to know if the messages could be processed in a medium or long term. 

I use the java client. To solve my problem I thought in: 

1- to use the method getConsumerCount of the queue. 

AMQP.Queue.DeclareOk my_queue = queueDeclare("name_queue", false, false, false, null); 
int cont = my_queue.getConsumerCount(); 

but, the consumer is disconnected of the queue when it is processing the message. For this reason, the Producer fails to recognize that there are Consumers for to work when really yes exist. 

2- Declaring a queue as passive in the Producer and autodelete in the Consumer. Thus, the queue only exists when the Consumer is connected and the queue is destroyed when the Consumer dies. 

In el Consumer: channel.queueDeclare("nam_queue", false, false, true, null); 

but the queue is also destroyed when the Consumer reads every message. 

Any idea for to know in the Producer if there are Consumers connected? 

Thanks in advance. 
Yuri. 


10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS INFORMATICAS...
CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION

http://www.uci.cu
http://www.facebook.com/universidad.uci
http://www.flickr.com/photos/universidad_uci
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120630/66df9f85/attachment.htm>


More information about the rabbitmq-discuss mailing list