Skip to main content

snodra-messaging-kafka

The Apache Kafka event store for the Snodra messaging suite: publishers append a service's events to the shared topic and every processor reads them in a consumer group of its own.

Install

pip install snodra-messaging-kafka

The distribution needs Python 3.12 or later and depends on snodra-messaging and aiokafka. The core library never imports a Kafka client; this add-on is where it lives.

Use

import asyncio

import snodra
from snodra_kafka import KafkaConfig, KafkaEventStore


async def main() -> None:
    settings = snodra.Settings.from_env(service="orders-service")
    events = KafkaEventStore(KafkaConfig.from_env())
    try:
        # The message store keeps the outbox, the processed-event markers and the dead letters;
        # the event store is the Kafka log the relay publishes to and the processors read.
        app = snodra.App(settings, store=snodra.MemoryStore(), event_store=events)
        await app.run()
    finally:
        await events.close()


asyncio.run(main())

KafkaConfig() defaults to the bootstrap servers kafka:19092; KafkaConfig.from_env() reads SNODRA_KAFKA_BOOTSTRAP and falls back to that default. client_id, request_timeout_ms, session_timeout_ms, max_poll_records, status_refresh and admin_timeout are the add-on's own bounds.

The events source is a topic (snodra.events by default), a segment is the partition number in decimal and a position is the offset in decimal. The record key is the event key, the value the JSON payload, every event header a record header with the same name, looked up by name and never by place. A keyed record is partitioned the way the Java client's default partitioner does it (murmur2 of the key's UTF-8 bytes, masked positive, modulo the partitions), so one key from any Snodra publisher lands on one partition and keeps its order there.

A subscription joins the consumer group named after <service>.<processor> on the classic group protocol with the range assignor, so it shares a group with every other official add-on. Committed offsets are written explicitly and are the next offset to read; a new group starts at the earliest offset. The add-on declares replay, lag and native-dead-letter; it has no event browser and declares no browse. Dead letters of the event-store mode go to <source>.dlt.

The add-on creates no topic: the infrastructure does, and the broker must keep auto.create.topics.enable=false (the add-on's tests pin it off). With auto-creation on, the broker would create a missing topic on the first publish or subscription. A name no Kafka topic can have, a record too large for the broker or a refused authorization is rejected for good; a missing topic and any other failure (a missing topic may appear later) is retried by the outbox relay.

Where the public specification leaves a choice, SPEC-GAPS.md records what this library does.

Test

The tests start an Apache Kafka broker through Testcontainers (pinned by digest) and run the event-store conformance kit against it. Docker is required:

uv run pytest -q packages/snodra-messaging-kafka/tests

Metadata

Release files for snodra-messaging-kafka 0.5.0

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

Source distribution (sdist)

Source distribution for snodra-messaging-kafka 0.5.0
File Size Uploaded Provenance Actions
snodra_messaging_kafka-0.5.0.tar.gz 29.7 kB With provenance Details for snodra_messaging_kafka-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for snodra-messaging-kafka 0.5.0
File Interpreter ABI Platform Actions
snodra_messaging_kafka-0.5.0-py3-none-any.whl Python 3 none any Details for snodra_messaging_kafka-0.5.0-py3-none-any.whl

Total release size: 51.3 kB

Release files / snodra_messaging_kafka-0.5.0.tar.gz

Download URL snodra_messaging_kafka-0.5.0.tar.gz
Size 29.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6071be9aae33829527d7a4a6993b567e136ac8104f6821dfddd1aab3f1e0aaee
BLAKE2b-256 checksum
How to use checksums
98da92c59025569ded5e10b960e9cef26cfe52b40ffb28b3a3e2d37d99240f9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 26, 2026.

Transparency log

Release files / snodra_messaging_kafka-0.5.0-py3-none-any.whl

Download URL snodra_messaging_kafka-0.5.0-py3-none-any.whl
Size 21.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c94c90e8ac6ba2f33e6c4a320433a1ec98d84a7bfd879e2f13a90fa53fe09156
BLAKE2b-256 checksum
How to use checksums
5047db889522158057c97e55f75183d3fba3431b91675805e3de68f65801407e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 26, 2026.

Transparency log

Security for snodra-messaging-kafka 0.5.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for snodra_messaging_kafka-0.5.0.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 Nov 26, 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.

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