Does anyone know if there's a way to check the number of messages in a RabbitMQ queue from a client application?
I'm using the .NET client library.
Does anyone know if there's a way to check the number of messages in a RabbitMQ queue from a client application?
I'm using the .NET client library.
You can use the IModel's MessageCount method, documented here
http://www.rabbitmq.com/releases/rabbitmq-dotnet-client/v3.6.4/rabbitmq-dotnet-client-3.6.4-client-htmldoc/html/type-RabbitMQ.Client.IModel.html#method-M:RabbitMQ.Client.IModel.MessageCount(System.String)
edit: I know this is a very old post, but it is the first google response, and I hope it will help people looking for this answer in the future.
At least as of RabbitMQ 3.3.5, you can do this in a C# program without any RabbitMQ client library by calling the RabbitMQ Management HTTP API:
The username and password are the same as those you use to log into the RabbitMQ management console UI.
Response will be a JSON string with the list of queues, including their message counts, among other properties. (If you like, you can deserialize that JSON into a C# object using a library like Json.NET.)
The API documentation is installed along with the RabbitMQ management console and should be available on that server at http://MY_RABBITMQ_SERVER:15672/api .