[rabbitmq-discuss] Is it possible to get a "push" when number of messages reaches threshold?

Michael Klishin mklishin at gopivotal.com
Sun Jun 1 14:37:22 BST 2014

On 1 June 2014 at 17:34:11, rails (stammailbox at gmail.com) wrote:
> > 1. What is the best practice to get the number of messages in a  
> queue.
> I know I can get it via queue.getMessageCount()

Do a queue.declare (possibly with passive = true), check # of messages ready from
queue.declare-ok. You can also query queue stats using HTTP API.

> What is the best way if I want to react only when X messages arrive? 

Add a consumer and process deliveries in batches  in your own code.

> 2. And more important - can I get the number of messages in a queue  
> via push?

There is no such feature in RabbitMQ. You have to periodically check the counter.

Software Engineer, Pivotal/RabbitMQ

More information about the rabbitmq-discuss mailing list