fastmesh-kafka
Kafka adapter for FastMesh —
KafkaSource and KafkaSink via aiokafka.
Install
pip install fastmesh-kafka
Usage
from fastmesh import Bus
from fastmesh_kafka import KafkaSource, KafkaSink
source = KafkaSource(
topics=["orders"],
bootstrap_servers="localhost:9092",
group_id="pipeline-consumer",
auto_offset_reset="earliest",
)
sink = KafkaSink(
topic="processed-orders",
bootstrap_servers="localhost:9092",
)
await Bus().source(source).sink(sink).run()
KafkaSource
| Parameter | Default | Description |
|---|---|---|
topics |
(required) | List of topic names |
bootstrap_servers |
"localhost:9092" |
Broker addresses |
group_id |
"fastmesh" |
Consumer group ID |
auto_offset_reset |
"latest" |
"earliest" or "latest" |
enable_auto_commit |
True |
Auto-commit offsets |
value_deserializer |
JSON decode | (bytes) -> dict |
Each Kafka record → one Message. Kafka metadata in msg.metadata:
kafka_topic, kafka_partition, kafka_offset, kafka_key (if present).
KafkaSink
| Parameter | Default | Description |
|---|---|---|
topic |
(required) | Target topic name |
bootstrap_servers |
"localhost:9092" |
Broker addresses |
key_fn |
msg.id.encode() |
(Message) -> bytes | None |
value_serializer |
JSON encode | (dict) -> bytes |
The producer is lazily initialized on first send() and reused. Call
await sink.stop() on shutdown to flush and close.
With FastMesh plugins
from fastmesh.plugins.retry import Retry
from fastmesh.plugins.dlq import DeadLetterQueue, MemoryDLQStore
store = MemoryDLQStore()
bus = Bus().source(
KafkaSource(topics=["orders"], bootstrap_servers="kafka:9092")
).sink(
DeadLetterQueue(
Retry(KafkaSink("processed", bootstrap_servers="kafka:9092"), max_retries=3),
store=store,
)
)
Requirements
- Python 3.11+
- fastmesh >= 0.2
- aiokafka >= 0.11
Metadata
Release files for fastmesh-kafka 0.1.0
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 |
|---|---|---|---|---|
| fastmesh_kafka-0.1.0.tar.gz | 5.1 kB | Without provenance | Details for fastmesh_kafka-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fastmesh_kafka-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for fastmesh_kafka-0.1.0-py3-none-any.whl |
Total release size: 9.9 kB
Release files / fastmesh_kafka-0.1.0.tar.gz
| Download URL | fastmesh_kafka-0.1.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ddb07715ff7f8b1ce96aeedd2122e0a8679d0db3a73ddf67ceeeba245914b5a
|
|
BLAKE2b-256 checksum How to use checksums |
aa28869b64903e2e1daecc927d61216578dd2f5920db2e5f25c5cd3af10b873b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / fastmesh_kafka-0.1.0-py3-none-any.whl
| Download URL | fastmesh_kafka-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3584283f75a1c89694ece20932efc5f0f3ea526daba0ca050d32070b56507731
|
|
BLAKE2b-256 checksum How to use checksums |
fac7677bbe55c6b42770f64b79e7dffb50f0e2ea901e1b656a69de90e2644698
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for fastmesh-kafka 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.