RabbitMQ - Count the number of messages in a queue using the REST API

This assumes you have created a RabbitMQ user with the administrator tag.

Refer to the RabbitMQ REST API documentation.

The curl command with the --user option can be used to make an API connection to RabbitMQ. In this example, John Doe will make a connection to the RabbitMQ server listening on port 15671.

--request GET
--user john.doe:itsasecret
--url https://hostname:15671/api/queues


Or, you can specify a single queue.

--request GET
--user john.doe:itsasecret
--url https://hostname:15671/api/queues/vhost001/queue001


For the / vhost, use %2F.

--request GET
--user john.doe:itsasecret
--url https://hostname:15671/api/queues/%2F/queue001


Something like this should be returned for each queue. Notice this output includes a number of "messages" keys.



Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 117cc in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |