Skip to main content

RabbitMQ pub-sub for the Pico ecosystem: @consumer methods and @publisher clients over aio-pika.

Project description

pico-rabbitmq

PyPI Ask DeepWiki License: MIT CI (tox matrix) codecov Quality Gate Status Duplicated Lines (%) Maintainability Rating PyPI Downloads Docs Interactive Lab

RabbitMQ pub-sub for the pico ecosystem: @consumer methods and declarative @publisher clients over aio-pika. Covers what pico-celery does not: events, fan-out, topic routing.

Installation

pip install pico-rabbitmq

Quick start

rabbitmq:
  url: amqp://guest:guest@rabbit.internal/

Consume — a component method per queue, JSON body decoded for you:

from pico_ioc import component
from pico_rabbitmq import consumer

@component
class OrderProjections:
    @consumer("orders-projection", exchange="events", routing_key="orders.*")
    async def on_order_event(self, message: dict):
        ...

Publish — stubs, like a pico-httpx client:

from pico_rabbitmq import publisher, publish

@publisher
class OrderEvents:
    @publish(exchange="events", routing_key="orders.created")
    def order_created(self, message): ...

Semantics:

  • Consumers and publishers run on a dedicated background loop — works in sync scripts, FastAPI apps and workers alike, no lifespan wiring.
  • Each message resolves its component through the container (prototype scope = fresh instance per message).
  • Ack on success; on exception the message is logged and rejected without requeue (configure a dead-letter exchange to keep failures).
  • Sync publish stubs block until the broker confirms; async stubs await it.
  • Queues and named exchanges are declared durable; the connection closes on container shutdown.

Documentation

Full documentation: https://dperezcabrera.github.io/pico-rabbitmq/

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pico_rabbitmq-0.1.0.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pico_rabbitmq-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file pico_rabbitmq-0.1.0.tar.gz.

File metadata

  • Download URL: pico_rabbitmq-0.1.0.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pico_rabbitmq-0.1.0.tar.gz
Algorithm Hash digest
SHA256 377da5a862700bd4fc946b0a49ed09423394eddbea08ae7d48db9e286133d631
MD5 2d3ac305966a9f3491446c505f57efd9
BLAKE2b-256 d973d02c3ad223b5fa9da452490ddd60e899952d651bedbafde1afdbc2c6b840

See more details on using hashes here.

Provenance

The following attestation bundles were made for pico_rabbitmq-0.1.0.tar.gz:

Publisher: publish-to-pypi.yml on dperezcabrera/pico-rabbitmq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pico_rabbitmq-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pico_rabbitmq-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pico_rabbitmq-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c12ec51ed8fc0985eded5eb5e7b189a0746a942884ef750bf03399e187d7f0e0
MD5 c032597598a27809d49dc14518cee8ce
BLAKE2b-256 26d05523651e2ca5cfb5b6f95882a1c4e06f062e677e7e0d3a1ca2bbd5c56cfd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pico_rabbitmq-0.1.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on dperezcabrera/pico-rabbitmq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page