This release is a pre-release and may not be stable for production use.
benzene-kafka
Host Benzene Python handlers on Apache Kafka —
a self-hosted consumer and a Kafka-produce outbound client — the same handlers, no rewrite. Depends
only on benzene-core.
pip install benzene-kafka # the binding + testing helpers
pip install "benzene-kafka[kafka]" # + confluent-kafka for the real clients
from benzene.core import application_from, build_application
from benzene.kafka import KafkaConsumerApp, KafkaMessageSender, run_consumer_loop
# Inbound: one record -> one pipeline invocation -> one scope; ack/log, no reply.
definition, _ = build_application(OrdersStartUp)
app = KafkaConsumerApp(application_from(definition))
await run_consumer_loop(app, consumer) # consumer: a confluent_kafka.Consumer
# Outbound: publish to a Kafka topic, Benzene topic carried in the `topic` header.
sender = KafkaMessageSender("orders-events", bootstrap_servers="localhost:9092")
await sender.send_message("orders:created", order, headers={"x-correlation-id": "abc"})
- Consumer — the Benzene topic comes from the record's
topicheader (the cross-port convention); the other Kafka headers are the Benzene headers (UTF-8), the value is the JSON body. One record is one scope; there is no response channel, so the result is acknowledge/log only —run_consumer_loopcommits the offset on success (at-least-once) and leaves a failed record for redelivery. A poison record can never crash the loop. - Outbound —
KafkaMessageSenderimplements thebenzene.core.MessageSenderport overconfluent-kafka(optional extra), forwarding the header dictionary onto the record's Kafka headers so correlation/trace propagation rides across the hop.
The binding is duck-typed against confluent-kafka, so decode, dispatch, and send are exercised in
memory with fakes — no broker, no SDK. Test through benzene.kafka.testing (a native-record builder +
a test host) or the shared harness (create_test_host(StartUp).build_kafka() + send_kafka) — see the
runnable examples/kafka_orders/. Mirrors .NET's Benzene.Kafka.Core, and contributes the
benzene.kafka subpackage to the shared benzene namespace.
Metadata
Release files for benzene-kafka 0.1.0b2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| benzene_kafka-0.1.0b2.tar.gz | 10.3 kB | With provenance | Details for benzene_kafka-0.1.0b2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| benzene_kafka-0.1.0b2-py3-none-any.whl | Python 3 | none | any | Details for benzene_kafka-0.1.0b2-py3-none-any.whl |
Total release size: 23.3 kB
Release files / benzene_kafka-0.1.0b2.tar.gz
| Download URL | benzene_kafka-0.1.0b2.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb54e110ea9c5aeda6886cc990793e18af26dd4ef2d26b73852fc6d2b54de537
|
|
BLAKE2b-256 checksum How to use checksums |
48013d19c1dfca3bdb772d232e16cd89411dec926976f99f373f729d94a5a6fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 16, 2026.
Transparency logRelease files / benzene_kafka-0.1.0b2-py3-none-any.whl
| Download URL | benzene_kafka-0.1.0b2-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4bfe4d0de77cf0565c37efedd10a2b5116e58cceb5a48efb30a5d1cf45321cd6
|
|
BLAKE2b-256 checksum How to use checksums |
c7cc12f026fa5722e273f60fcde3547cba804b3b7bc3f51ea61298a3940da4ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 16, 2026.
Transparency logSecurity for benzene-kafka 0.1.0b2
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.
Attestation for benzene_kafka-0.1.0b2.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 Oct 16, 2026.
Transparency logA 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.