Skip to content
Latchkey

rabbitmqadmin declare queue: Set Up Queues

rabbitmqadmin declare queue name=<q> durable=true creates a queue through the RabbitMQ management HTTP API, ideal for provisioning before an integration test.

rabbitmqadmin is a Python client that drives the management plugin over HTTP. It is the simplest way to declare queues, exchanges, and bindings from a CI setup step without writing AMQP code.

What it does

rabbitmqadmin talks to the RabbitMQ management plugin (port 15672 by default). declare queue creates a queue with the properties you pass; durable=true survives a broker restart. It requires the management plugin to be enabled and valid credentials.

Common usage

Terminal
rabbitmqadmin declare queue name=orders durable=true
# with explicit host, vhost, and credentials
rabbitmqadmin -H localhost -P 15672 \
  -u guest -p guest --vhost=/ \
  declare queue name=orders durable=true
# declare an exchange and a binding too
rabbitmqadmin declare exchange name=events type=topic durable=true
rabbitmqadmin declare binding source=events destination=orders routing_key=order.*

Options

Flag / argWhat it does
declare queue name=<q>Queue to create
durable=trueMake the queue survive a restart
-H <host> / -P <port>Management host and port (default 15672)
-u <user> / -p <pass>Credentials for the HTTP API
--vhost=<vhost>Virtual host to declare in (default /)
auto_delete=trueDelete the queue when the last consumer leaves

In CI

Point -P at the management port 15672, not the AMQP port 5672; a common mistake is aiming rabbitmqadmin at 5672 and getting a connection or protocol error. Declare all queues and exchanges in a setup step so your test starts from a known topology.

Common errors in CI

"Access refused for user 'guest'" means wrong credentials, or the guest user being restricted to localhost only (the default), so it fails from another container. "Not found: /api/queues/..." often means the management plugin is not enabled (rabbitmq-plugins enable rabbitmq_management). A connection refused on 15672 means the management port is not exposed or the broker is not ready yet.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →