Search code examples
rabbitmqrabbitmqctl

RabbitMQ -- list consumer names for a queue


Is there way to list names of consumers subscribed to a queue? With "rabbitmqctl list_queues -p test name,consumers" I could get the number of consumers to a queue but not their names.

I see two consumers where I expect one. I need to figure out who the other consumer is.


Solution

  • rabbitmqctl list_consumers -p [vhost]
    

    Which will list consumers, i.e. subscriptions to a queue´s message stream. Each line printed shows, separated by tab characters, the name of the queue subscribed to, the id of the channel process via which the subscription was created and is managed, the consumer tag which uniquely identifies the subscription within a channel, a boolean indicating whether acknowledgements are expected for messages delivered to this consumer, an integer indicating the prefetch limit (with 0 meaning "none"), and any arguments for this consumer.

    Sample output:

    queue_name      channel_pid     consumer_tag    ack_required    prefetch_count  active  arguments
    db_weibo_users  <rabbit@host>    None86  true    300     true    []
    db_weibo_users  <rabbit@host>     None88  true    300     true    []
    db_weibo_users  <rabbit@host>      None85  true    300     true    []
    db_weibo_users  <rabbit@host>     None85  true    300     true    []