How to List Exchanges in RabbitMQ: Commands and Examples
rabbitmqctl list_exchanges command in the terminal or view them in the RabbitMQ Management UI under the Exchanges tab. The CLI command shows exchange names and types quickly.Syntax
The basic command to list exchanges in RabbitMQ is rabbitmqctl list_exchanges [options]. You can add specific fields to display, such as name and type.
Example fields: rabbitmqctl list_exchanges name type
This command connects to the RabbitMQ server and prints a list of all exchanges with the requested details.
rabbitmqctl list_exchanges [field1] [field2] ...
Example
This example shows how to list all exchanges with their names and types using the RabbitMQ CLI tool.
rabbitmqctl list_exchanges name typeCommon Pitfalls
One common mistake is running rabbitmqctl commands without proper permissions or without the RabbitMQ server running, which causes errors.
Another is forgetting to specify fields, which still works but shows default columns that might not be useful.
Also, mixing up exchanges with queues can confuse beginners; exchanges route messages, queues store them.
Wrong:
rabbitmqctl list_queues
Right:
rabbitmqctl list_exchanges name typeQuick Reference
| Command | Description |
|---|---|
| rabbitmqctl list_exchanges | Lists all exchanges with default fields |
| rabbitmqctl list_exchanges name type | Lists exchanges showing their names and types |
| rabbitmqctl list_exchanges name type durable | Lists exchanges with durability status |
| rabbitmqctl list_queues | Lists queues (not exchanges) |
| Access Management UI | View exchanges under the Exchanges tab in the RabbitMQ web UI |