Bootstrap FreeKB - RabbitMQ - Count the number of messages in a queue using the rabbitmqctl command
RabbitMQ - Count the number of messages in a queue using the rabbitmqctl command

Updated:   |  RabbitMQ articles

The rabbitmqctl command with the list_queues option can be used to list a virtual hosts queues and the number of messages in each queue.

rabbitmqctl list_queues

 

Which should produce something like this. By default, if the -p option is not used, the / virtual host will be used.

Listing queues for vhost / ...
name     messages
queue001 0
queue002 0

 

The -p option can be used to specify a virtual host, like this.

rabbitmqctl list_queues --vhost vhost001

 

Which should produce something like this.

Listing queues for vhost vhost001
name     messages
queue001 0
queue002 17

 

You can specify the items you wish to include in the output, like this.

rabbitmqctl list_queues name state messages messages_ready --vhost vhost001

 

Which should produce something like this.

Listing queues for vhost vhost001
name     state    messages messages_ready message_bytes_ready
queue001 running  0        0              0
queue002 running  17       17             157754

 

The --formatter json option can be used to return the output in JSON.

rabbitmqctl list_queues --formatter json



Did you find this article helpful?

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



Comments


Add a Comment


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