[rabbitmq-discuss] To know when a queue is empty from a Java client
Florence Chabanois
flocha2000-agile at yahoo.fr
Thu Aug 26 15:34:20 BST 2010
Hum indeed, this is literally our code...
So if declare_ok always refers to a new queue, we have no choice but use Runtime.exec("rabbitmqctl list_queues") if we want to know this kind of information on an existing queue?
Cheers,Florence.
--- En date de : Jeu 26.8.10, Simon MacMullen <simon at rabbitmq.com> a écrit :
De: Simon MacMullen <simon at rabbitmq.com>
Objet: Re: [rabbitmq-discuss] To know when a queue is empty from a Java client
À: rabbitmq-discuss at lists.rabbitmq.com
Date: Jeudi 26 août 2010, 16h13
On 26/08/10 15:05, Florence
Chabanois wrote:
> Thanks for your answer !
>
> We may be using it in a wrong way but so far, the method
> getMessageCount() always displays 0 message, when /"rabbitmqctl
> list_queues"/ displays 8 messages or keeps growing.
>
> DeclareOk declareOk = channel.queueDeclare();
That's declaring a *new* server-named queue - which has 0 messages in
it. Is that literally your code, or a paraphrase?
Cheers, Simon
> System.out.println(">>>> MESSAGES : " + declareOk.getMessageCount());
>
>
> Cheers,
> Florence.
>
> --- En date de : *Jeu 26.8.10, Michael Bridgen /<mikeb at rabbitmq.com>/* a
> écrit :
>
>
> De: Michael Bridgen <mikeb at rabbitmq.com>
> Objet: Re: [rabbitmq-discuss] To know when a queue is empty from a
> Java client
> À: flocha2000-agile at yahoo.fr
> Cc: rabbitmq-discuss at lists.rabbitmq.com
> Date: Jeudi 26 août 2010, 15h24
>
> > From a Java client we need to know when a queue is empty.
> > Is there a way to know it via the Java api (or to know the number
> > of messages in a queue).
> >
> > We would rather
have another way than calling /"rabbitmqctl
> list_queues"/
> > via Runtime.exec()
>
> A queue.declare_ok frame includes the number of messages on the
> queue; so, you could send a passive queue.declare, and examine the
> response.
>
> Regards,
> Michael
>
>
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
--
Simon
MacMullen
Staff Engineer, RabbitMQ
SpringSource, a division of VMware
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
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/20100826/9800cd49/attachment-0001.htm>
More information about the rabbitmq-discuss
mailing list