How to get consumer count for a RabbitMQ queue using the HTTP API

rabbitmq

I can get the number of consumers using rabbitmqctl as such:

# rabbitmqctl list_queues name consumers  | grep q-firewall-plugin
q-firewall-plugin   2

But when using the API url:

/api/queues/%2F/q-firewall-plugin

It responds with:

{
    "consumer_details":[],
    "name":"q-firewall plugin",
    "vhost":"/",
    "durable":true, 
    "auto_delete":false,
    "arguments":{"x-ha-policy":"all"},
    "node":"rabbit@infra-rabbitmq-2"
}

I was expecting to see a couple of consumers in consumer_details. What am I doing wrong ?

Best Answer

There should be another field called consumers which gives you the count.

{
    "consumers": 0,
    "consumer_details": [],
    "name": "Liquid.RPC.Debug",
}