Does anyone know if there's a way to check the number of messages in a queue from a client application? Thanks.
BTW, I'm using .NET client libraty.
Does anyone know if there's a way to check the number of messages in a queue from a client application? Thanks.
BTW, I'm using .NET client libraty.
You cant recieve this information in-band via AMQP. But you can use OTP.NET to communicate with the Erlang node directly. See for the Java-Implementation of this problem: http://leftrightfold.com/2009/04/26/how-to-build-rabbit-management-console/ About OTP.NET: http://weblogs.asp.net/nleghari/archive/2008/01/08/integrating-net-and-erlang-using-otp-net.aspx
To add on this: another option might be using Alice which exposes broker information via RESTful webservices: http://willcodeforfoo.com/2009/07/13/announcing-alice/
You actually can retrieve this via the client. When perform a queue_declare
operation RabbitMQ returns a three tuple containing (<queue name>, <message count>, <consumer count>)
. The passive
argument to queue_declare allows you to check whether a queue exists without modifying the server state. So you can use queue_declare
with the passive
option to check queue length. Not sure about .NET, but in Python it looks something like this:
name, jobs, consumers = chan.queue_declare(queue=queuename, passive=True)