Skip to content

CLI

The rabbitkit CLI provides commands for running consumers, health checks, topology inspection, DLQ management, and interactive debugging.

Install the CLI extra:

pip install rabbitkit[cli]

run

Start a broker and block until SIGINT/SIGTERM.

rabbitkit run myapp.main:broker
rabbitkit run myapp.main:broker --worker-count 4
rabbitkit run myapp.main:broker --reload        # hot-reload on file changes

health

Kubernetes-friendly health probes. Exit code 0 = healthy, 1 = unhealthy.

# Liveness: returns 0 even when reconnecting (process is still alive)
rabbitkit health liveness myapp.main:broker

# Readiness: returns 1 when disconnected or consumers not active
rabbitkit health readiness myapp.main:broker

topology

Inspect and manage RabbitMQ topology declared by the broker.

topology list

Print registered routes, queues, and exchanges.

rabbitkit topology list myapp.main:broker
rabbitkit topology list myapp.main:broker --format json

topology validate

Compare declared topology against the live broker. Exit code 1 if mismatches are found.

rabbitkit topology validate myapp.main:broker
rabbitkit topology validate myapp.main:broker --url http://guest:guest@localhost:15672 --vhost /

topology diff

Show what is declared in code but missing from RabbitMQ, and vice versa.

rabbitkit topology diff myapp.main:broker
rabbitkit topology diff myapp.main:broker --format json

Output symbols: - + — declared in code, missing from RabbitMQ - ~ — in RabbitMQ, not declared in code - ! — property mismatch (e.g. durable differs)

topology apply

Declare all registered queues and exchanges via AMQP. Safe to run repeatedly.

rabbitkit topology apply myapp.main:broker
rabbitkit topology apply myapp.main:broker --url amqp://guest:guest@localhost/
rabbitkit topology apply myapp.main:broker --dry-run   # preview without connecting

dlq

Inspect and replay dead-letter queues.

dlq inspect

View messages in a DLQ without consuming them.

rabbitkit dlq inspect orders.created.dlq
rabbitkit dlq inspect orders.created.dlq --full        # include full body
rabbitkit dlq inspect orders.created.dlq --limit 20

dlq replay

Re-publish messages from a DLQ back to the original exchange.

rabbitkit dlq replay orders.created.dlq orders
rabbitkit dlq replay orders.created.dlq orders --limit 10

Messages are republished with the original routing key and headers, with x-retry-count reset to 0. Replay uses publisher confirms — if a message fails to publish, replay stops and reports the error.


routes

Inspect registered handler routes.

# List all routes
rabbitkit routes list myapp.main:broker

# Describe a specific route
rabbitkit routes describe myapp.main:broker orders.created

shell

Open an interactive Python shell with the broker pre-loaded (requires IPython).

rabbitkit shell myapp.main:broker

cli

rabbitkit CLI — production-grade RabbitMQ toolkit.

Provides the rabbitkit command-line interface for running, inspecting, and interacting with rabbitkit brokers.

Requires: pip install rabbitkit[cli]

Available commands

rabbitkit run Start a broker rabbitkit run --reload Start with hot-reload (requires rabbitkit[reload]) rabbitkit run -w 4 Start 4 worker processes

rabbitkit health check Print broker health as JSON

rabbitkit topology list List all registered routes

rabbitkit routes list List all consumer routes with retry info rabbitkit routes describe Show full route details

rabbitkit dlq inspect Peek at messages in a dead-letter queue rabbitkit dlq replay Republish DLQ messages to a target exchange

rabbitkit shell Open interactive Python shell with broker pre-loaded

App path format

<module.path>:<attribute_name>

Examples::

rabbitkit run myapp.main:broker
rabbitkit health check myapp.main:broker
rabbitkit topology list myapp.main:broker --format json
rabbitkit routes list myapp.main:broker
rabbitkit routes describe myapp.main:broker handle_order
rabbitkit dlq inspect orders.created.dlq --limit 50
rabbitkit dlq replay orders.created.dlq orders --dry-run
rabbitkit shell myapp.main:broker

The module must be importable from the current working directory (add it to PYTHONPATH if needed, or run from the project root).

Installation check::

pip install "rabbitkit[cli]"
rabbitkit --help

Functions:

rabbitkit topology migrate

Classic→quorum queue migration: plan (default, never mutates), --execute --strategy drain-cutover|bridge, --dry-run, --resume. See the quorum migration guide.