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.8.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.8.0
File Size Uploaded Provenance Actions
snodra_messaging_kafka-0.8.0.tar.gz 29.7 kB With provenance Details for snodra_messaging_kafka-0.8.0.tar.gz

Built distribution (wheel)

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

Total release size: 51.3 kB

Release files / snodra_messaging_kafka-0.8.0.tar.gz

Download URL snodra_messaging_kafka-0.8.0.tar.gz
Size 29.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f536cafaad6f7cb6673cd63f00bc772c652a934bde27ebe5bf7f29df37d00d18
BLAKE2b-256 checksum
How to use checksums
f831cad2523e5ff1bd5e795a431ffd9927f55897a8d4d2792a6cb5d9b6230f53
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 28, 2026.

Transparency log

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

Download URL snodra_messaging_kafka-0.8.0-py3-none-any.whl
Size 21.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3f951fc5e14d9ca5c9d8afce320a7190ea801ad0a384daef9c050ba2a7870f5
BLAKE2b-256 checksum
How to use checksums
15751de904f539c9be2f96f8281802025a16de00a66428f8dce7cb4cb7c9b8ac
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 28, 2026.

Transparency log

Security for snodra-messaging-kafka 0.8.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.8.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 28, 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