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

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 -p 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 -p vhost001 name state messages messages_ready

 

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


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 4c30a in the box below so that we can be sure you are a human.




Comments

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