RabbitMQ - Listing channels using the rabbitmqctl list_channels command

A channel is created for each unique connection from a client system to RabbitMQ.

 

The rabbitmqctl command with the list_channels option can be used to list all of the current channels.

rabbitmqctl list_channels

 

Something like this should be returned.

~]# rabbitmqctl list_channels
Listing channels
pid                          user       consumer_count  messages_unacknowledged
<rabbit@server001.3.2404.0>  john.doe   0               0
<rabbit@server001.3.2408.0>  jane.doe   0               0
<rabbit@server001.3.7738.0>  jack.doe   1               0

 

The name and user options are commonly used to display the IP address and ephemeral port that the connection came from (source) and the IP address and AMQ port of the RabbitMQ system. In this example, the connections came from the 10.12.211.15 IP addresses and the RabbitMQ system has IP address 10.16.11.105 with port 5671 for AMQ connections.

~]# rabbitmqctl list_channels name user
10.12.211.15:11525 -> 10.16.11.105:5671 (1)    john.doe
10.12.211.15:17551 -> 10.16.11.105:5671 (2)    jane.doe
10.12.211.15:21155 -> 10.16.11.105:5671 (1)    jack.doe

 

Here are all of the possible options.

  • acks_uncommitted
  • confirm
  • connection
  • consumer_count
  • global_prefetch_count
  • messages_unacknowledged
  • messages_uncommitted
  • messages_unconfirmed
  • name
  • number
  • prefetch_count
  • transactional
  • user
  • vhost

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

rabbitmqctl list_channels --formatter json

 

Lisewise, events like this should be found in the RabbitMQ log for each channel connection.

2022-01-11 22:59:05.838 [info] <0.2445.0> accepting AMQP connection <0.2445.0> (10.12.211.15:21155 -> 10.16.11.105:5671)

2022-01-11 22:59:06.120 [info] <0.2445.0> connection <0.2445.0> (10.12.211.15:21155 -> 10.16.11.105:5671): user 'jack.doe' authenticated and granted access to vhost 'foo'

2022-01-11 22:59:13.869 [info] <0.2445.0> closing AMQP connection <0.2445.0> (10.12.211.15:21155 -> 10.16.11.105:5671, vhost: 'foo', user: 'jack.doe')

2022-01-11 22:59:13.871 [info] <0.2466.0> Closing all channels from connection '10.12.211.15:21155 -> 10.16.11.105:5671' because it has been closed

 




Did you find this article helpful?

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

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 28849 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   |