CLI¶
The rabbitkit CLI provides commands for running consumers, health checks,
topology inspection, DLQ management, and interactive debugging.
Install the CLI extra:
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.
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.
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 --limit 20
rabbitkit dlq inspect orders.created.dlq --management-url http://ops:secret@rabbit:15672
Each message is shown once: all fetched messages are held unacked until the
fetch ends, then requeued. On a quorum queue every requeue counts as a
delivery, so with --management-url (or RABBITMQ_MANAGEMENT_URL) the
command first checks the queue's delivery limit and refuses (exit 2) when
browsing could eventually drop messages. Without it, the command stops at
the first message carrying x-delivery-count. --no-delivery-limit-check
skips both. See Quorum DLQs and delivery limits.
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 their original routing key (--routing-key
overrides it) and headers verbatim; --reset-retry-count strips the retry
counter. Replay uses publisher confirms and mandatory=True: a message whose
republish fails stays on the DLQ, replay continues with the rest, and the
command exits 1. A message that would be published back into the DLQ itself
is skipped. --dry-run requeues what it shows, so it gets the same
delivery-limit checks as inspect.
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).
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
rabbitkit health check
rabbitkit topology list
rabbitkit routes list
rabbitkit dlq inspect
rabbitkit shell
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.