Flask-RMQ
Predictable RabbitMQ integration for Flask, without task-queue machinery
Flask native
App-factory extension, application contexts, and Click commands under the standard flask CLI.
Reliability first
Publisher confirms, mandatory routing, persistence, role-separated connections, DLX support, and bounded reconnects.
Small and explicit
Pika remains visible. Handlers decide when to ack; topology remains ordinary idempotent Python.
What Flask-RMQ is
Flask-RMQ wraps the repetitive and failure-prone edges of Pika while keeping AMQP semantics explicit. Use it when a Flask service needs to publish domain events, consume queues, declare topology, or connect to several RabbitMQ brokers.
It is not a scheduler, distributed task result backend, or Celery replacement. There is no hidden message format and no automatic serialization.
The producer and consumer connections are deliberately separate, even in one thread. A Pika BlockingConnection owns an I/O loop; sharing it between consuming and publishing can deadlock a publish performed inside a handler.
Included components
| Component | Purpose |
|---|---|
FlaskRMQ | Reads Flask config, creates per-alias state, registers CLI. |
Producer | Persistent confirmed publication with mandatory routing and one reconnect retry. |
Consumer | One handler per queue, QoS, reconnect backoff, graceful stop, DLX-friendly failure behavior. |
QueueConfig | Durable queue and optional dead-letter arguments. |
SetupRegistry | Idempotent exchange/queue/binding callbacks. |
ConsumersRegistry | Consumers discovered by flask rmq consume. |
Continue with , or run the .