Skip to content
Latchkey

rabbitmqctl list_queues: Queue Depth Checks

rabbitmqctl list_queues name messages consumers prints the depth and consumer count of every queue, run from inside the broker node.

Unlike rabbitmqadmin (HTTP), rabbitmqctl connects to the Erlang node directly. It works without the management plugin, which makes it handy inside the broker container in CI.

What it does

rabbitmqctl is the node control tool. list_queues prints per-queue metrics; you choose the columns (name, messages, messages_ready, messages_unacknowledged, consumers). It connects to the local RabbitMQ node using the shared Erlang cookie, so it must run on (or be pointed at) the broker node.

Common usage

Terminal
rabbitmqctl list_queues name messages consumers
# restrict to a vhost
rabbitmqctl list_queues -p /my-vhost name messages
# run inside the broker container
docker exec rabbitmq rabbitmqctl list_queues name messages_ready

Options

Flag / colWhat it does
list_queues [cols...]Choose columns to print
-p <vhost>Restrict to a virtual host
messagesTotal messages (ready + unacked)
messages_readyMessages ready for delivery
messages_unacknowledgedDelivered but not yet acked
consumersNumber of consumers on the queue

In CI

Run it via docker exec into the broker container so the Erlang cookie and node name match; running it from a separate container without the same cookie fails. It is a good post-test assertion: check messages_ready is 0 to prove your consumer drained the queue.

Common errors in CI

"Error: unable to perform an operation on node ... Hostname mismatch" or "Could not decrypt ... erlang cookie" means the cookie or node name does not match; exec into the actual broker node instead. "Error: {:badrpc, :nodedown}" means the broker is not fully started; wait for it. An empty result usually means the wrong -p vhost.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →