With RabbitMQ, a connection and a channel are similar, but not exactly the same. A connection is the TCP connection that an application makes to RabbitMQ. The connection will have one or more channels, and the AMPQ tasks, such as publishing or consuming messages, are done over the channel.
The rabbitmqctl command with the list_connection option can be used to list all of the current connections.
~]# rabbitmqctl list_connections Listing connections ... user peer_host peer_port state john.doe 10.17.16.122 34715 running jane.doe 10.14.17.113 57745 running jack.doe 10.17.16.122 60765 running
By default, the user that initiated the connection, the users IP address and port, and the state of the connection will be returned. You can include the fields you want returned, such as user, name and state.
~]# rabbitmqctl list_connections user name state Listing connections ... user name state john.doe 10.17.16.122:34715 -> 10.9.15.201:5671 running jane.doe 10.14.17.113:57745 -> 10.9.15.201:5671 running jack.doe 10.17.16.122:60765 -> 10.9.15.201:5671 running
Here are all of the possible options.
The --formatter json option can be used to return the output in JSON.
rabbitmqctl list_connections --formatter json