RabbitMQ - Count the number of messages in a queue using the rabbitmqadmin command

by
Jeremy Canfield |
Updated: January 12 2021
| RabbitMQ articles
This assumes you have downloaded and setup the rabbitmqadmin command line tool.
The rabbitmqadmin command with the list queues option can be used to list a virtual hosts queues, including the number of messages in the queue. Or, the rabbitmqctl list_queues command can be used. Or, the curl command can be used.
rabbitmqadmin list queues
Which should produce something like this.
+-------------------------------------------------------------+----------+
| name | messages |
+-------------------------------------------------------------+----------+
| queue001 | 0 |
| queue002 | 378 |
+-------------------------------------------------------------+----------+
You can specify the items you wish to include in the output, like this.
rabbitmqadmin list queues messages name vhost
Which should produce something like this.
+----------+-------------------------------------------------------------+-------+
| messages | name | vhost |
+----------+-------------------------------------------------------------+-------+
| 0 | queue001 | / |
| 378 | queue002 | / |
+----------+-------------------------------------------------------------+-------+
Did you find this article helpful?
If so, consider buying me a coffee over at