Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

benzene-rabbitmq

Host Benzene Python handlers on RabbitMQ — a self-hosted consumer and a RabbitMQ-publish outbound client — the same handlers, no rewrite. Depends only on benzene-core.

pip install benzene-rabbitmq               # the binding + testing helpers
pip install "benzene-rabbitmq[rabbitmq]"   # + pika for the real clients
from benzene.core import application_from, build_application
from benzene.rabbitmq import RabbitMqConsumerApp, RabbitMqMessageSender, run_consumer_loop

# Inbound: one delivery -> one pipeline invocation -> one scope; ack/log, no reply.
definition, _ = build_application(OrdersStartUp)
app = RabbitMqConsumerApp(application_from(definition))
await run_consumer_loop(app, channel, queue="orders")  # channel: a pika channel

# Outbound: publish to an exchange, Benzene topic carried in the `topic` header.
sender = RabbitMqMessageSender("orders-events", host="localhost")
await sender.send_message("orders:created", order, headers={"x-correlation-id": "abc"})
  • Consumer — the Benzene topic comes from the topic header carried in the delivery's AMQP properties.headers (the cross-port convention); the other headers are the Benzene headers (UTF-8), the body is the JSON body. One delivery is one scope; there is no response channel, so the result is acknowledge/log only — run_consumer_loop acks the delivery on success (at-least-once) and nacks a failed one for redelivery. A poison delivery can never crash the loop.
  • OutboundRabbitMqMessageSender implements the benzene.core.MessageSender port over pika (optional extra), forwarding the header dictionary onto the AMQP properties.headers so correlation/trace propagation rides across the hop.

The binding is duck-typed against pika, so decode, dispatch, and publish are exercised in memory with fakes — no broker, no SDK. Test through benzene.rabbitmq.testing (a native-delivery builder + a test host) or the shared harness (create_test_host(StartUp).build_rabbitmq() + send_rabbitmq) — see the runnable examples/rabbitmq_orders/. Mirrors .NET's Benzene.RabbitMq, and contributes the benzene.rabbitmq subpackage to the shared benzene namespace.

Download files

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

Source Distribution

benzene_rabbitmq-0.1.0b1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

benzene_rabbitmq-0.1.0b1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file benzene_rabbitmq-0.1.0b1.tar.gz.

File metadata

  • Download URL: benzene_rabbitmq-0.1.0b1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for benzene_rabbitmq-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 42241f3d1f38d34fa03a4c8fcb2e2ff0f7a85d7a7e7e81b42abd840291ecd9fa
MD5 3f37878d0fe074cd9064a572827c5d89
BLAKE2b-256 dd90fecc26059be343dec03c261faa23dad8685e0065609b47e5c83932eb07de

See more details on using hashes here.

Provenance

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

Publisher: release.yml on daniellepelley/benzene-python

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

File details

Details for the file benzene_rabbitmq-0.1.0b1-py3-none-any.whl.

File metadata

File hashes

Hashes for benzene_rabbitmq-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 93c3ef19f5d094a6c52707ba2a7d65a819580131e05a96ec0380a13fb9520cca
MD5 0ea14c66de02e3c2c25273f50ddb5fef
BLAKE2b-256 ce635ef241846a328fd273bfb8c22b7575265a18e0e54ed9ecc232c6185425e6

See more details on using hashes here.

Provenance

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

Publisher: release.yml on daniellepelley/benzene-python

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

Release history Release notifications | RSS feed

This release

0.1.0b1 This release

2 files

Supported by

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