Skip to main content

Flask-RMQ

License: MIT Ruff PyPI PyPI pyversions PyPI status PyPI downloads PyPI types


RabbitMQ Support Flask Support


Documentation: https://flask-rmq.rdd-lab.com/

Source Code: https://github.com/RDDLab/Flask-RMQ


Flask-RMQ

Flask-RMQ provides typed RabbitMQ wrappers and tools for Flask applications using Pika.

It is not a task queue or a Celery replacement. It is a lightweight integration layer for services that need explicit message contracts, reliable publication, long-running consumers, topology management, and multiple independent RabbitMQ brokers.

Main features:

  • standard Flask extension and app-factory integration;
  • Click commands under the native flask rmq CLI group;
  • separate thread-local producer and consumer connections;
  • publisher confirms, persistent delivery, and mandatory=True routing;
  • bounded producer retry and consumer exponential backoff;
  • durable queues and dead-letter routing through QueueConfig;
  • per-alias topology and consumer registries;
  • optional Prometheus instrumentation;
  • Python typing with a py.typed marker.

Installation

Install Flask-RMQ with pip or your preferred Python package manager:

pip install Flask-RMQ

Prometheus support is optional:

pip install 'Flask-RMQ[metrics]'

Flask-RMQ supports Python 3.10–3.14 and Flask 3.0–3.1.

Minimal application

import json

from flask import Flask
from flask_rmq import (
    Consumer,
    FlaskRMQ,
    Producer,
    get_consumers_registry,
    get_setup_registry,
)

rmq = FlaskRMQ()
producer = Producer(queue='events')
consumer = Consumer(queue='events')


@consumer
def handle_event(channel, method, properties, body: bytes) -> None:
    print(json.loads(body))
    channel.basic_ack(delivery_tag=method.delivery_tag)


def setup_topology(channel) -> None:
    channel.queue_declare(queue='events', durable=True)


def create_app() -> Flask:
    app = Flask(__name__)
    app.config['RABBITMQ_CONNECTIONS'] = {
        'default': {'HOST': 'localhost'},
    }
    rmq.init_app(app)
    with app.app_context():
        get_setup_registry().register(setup_topology)
        get_consumers_registry().register(consumer)
    return app
flask --app your_app:create_app rmq check
flask --app your_app:create_app rmq setup
flask --app your_app:create_app rmq consume

Publish from a Flask route or service:

producer.publish(json.dumps({'event': 'created'}))

The complete runnable producer/consumer project is available in examples/basic_app.

Tests

python -m venv .venv
. .venv/bin/activate
pip install -e '.[dev,metrics]'
pytest
ruff check .
python -m build

The unit test suite does not require a live RabbitMQ broker. Use the example project for an end-to-end broker test.

Documentation portal

The VuePress portal contains complete English and Russian guides for configuration, producers, consumers, topology, CLI, reliability, metrics, the example project, and migration from Django-RMQ.

npm install
npm run docs:dev
npm run docs:build

MIT licensed.

Metadata

Release files for Flask-RMQ 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-RMQ 0.1.1
File Size Uploaded Provenance Actions
flask_rmq-0.1.1.tar.gz 15.9 kB With provenance Details for flask_rmq-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Flask-RMQ 0.1.1
File Interpreter ABI Platform Actions
flask_rmq-0.1.1-py3-none-any.whl Python 3 none any Details for flask_rmq-0.1.1-py3-none-any.whl

Total release size: 38.5 kB

Release files / flask_rmq-0.1.1.tar.gz

Download URL flask_rmq-0.1.1.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ddc8422f907608c26a4c5f002e8926c704251411c567a869b559374b3742785b
BLAKE2b-256 checksum
How to use checksums
2226fdaf773956d71eb477dd860ce01b6ad21286d6207583f6c47c2d12162f0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 28, 2026.

Transparency log

Release files / flask_rmq-0.1.1-py3-none-any.whl

Download URL flask_rmq-0.1.1-py3-none-any.whl
Size 22.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04bd2430aeba63ef5e1c3532bef67cdd5bf8fd67659d0a683a06ea318189a14d
BLAKE2b-256 checksum
How to use checksums
de7a5da50b57403ff8630994cf9fa4f4ad11eefc97bdf22fc5b8b527f6ac3b0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 28, 2026.

Transparency log

Security for Flask-RMQ 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for flask_rmq-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page