Retriable Kafka Client
This is an opinionated wrapper for confluent_kafka Python library.
It only uses specific parts of the underlying library while introducing
additional functionalities to these selected parts.
Features
The aim is to provide a fault-tolerant platform for parallel message processing.
Parallel processing
Each consumer requires an executor pool, which will be used for message processing. Each consumer can consume from multiple topics and processes the messages from these topics by a single callable. The callable must be specified by the user of this library.
The library also ensures exactly-once processing when used correctly. To ensure this, the tasks should take short enough time that all of them finish before the cluster forces rebalancing. The library tries to finish tasks from revoked partitions before the rebalance while stopping additional non-started tasks. The default timeout for each task to finish is 30 seconds, but can be changed. Kafka cluster behavior change may also be needed with longer tasks. This behavior only appears during rebalancing and graceful stopping of the consumer.
Fault-tolerance
Each consumer accepts configuration with retry topics. A retry topic is a Kafka topic used for asynchronous retrying of message processing. If the specified target callable fails, the consumer will commit the original message and resends the same message to a retry topic with special headers. The headers include information about the next timestamp at which the message should be processed again (to give some time to the error to disappear if the processing depends on some outside infrastructure).
The retry topic is polled alongside the original topic. If a message contains the special timestamp header, its Kafka partition of origin will be paused and the message will be stored locally. The processing will resume only after the specified timestamp passes. The message will not be processed before the timestamp, it can only gather delay (depending on the occupation of the worker pool). Once the message is sent to the pool for re-processing, the consumption of the blocked partition is resumed.
This whole mechanism does not ensure message ordering. When a message is sent to be retried, another message processing from the same topic is still unblocked.
Message splitting
This library also supports sending large messages to topics which don't have the capacity to process these messages as whole. To do this, producers are configurable to automatically split messages according to message size.
This feature is custom and is therefore turned off by default. The only place this feature is always enabled are retry-topics, which are meant to be consumed only by clients using this library.
The chunked messages have 3 additional headers:
- Group ID (uuid4 value)
- Chunk ID (serial number of the chunk within group, starting with 0)
- Number of chunks (is always +1 from the last chunk ID)
Message is deserialized and processed only if all expected chunks have been found.
Contributing guidelines
To check contributing guidelines, please check CONTRIBUTING.md in the
GitHub repository.
Metadata
Release files for retriable-kafka-client 0.7.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 | |
|---|---|---|---|---|
| retriable_kafka_client-0.7.0.tar.gz | 26.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| retriable_kafka_client-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 57.4 kB
Release files / retriable_kafka_client-0.7.0.tar.gz
| Download URL | retriable_kafka_client-0.7.0.tar.gz |
|---|---|
| Size | 26.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a22d6cadb188864e53be34fc0189445b82dd0070b3852a6b9c816267adf43120
|
|
BLAKE2b-256 checksum How to use checksums |
32e7dbf388645103578c56cbf7aa5de85be5cdcb99eebf35b9ca05f92827a80e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / retriable_kafka_client-0.7.0-py3-none-any.whl
| Download URL | retriable_kafka_client-0.7.0-py3-none-any.whl |
|---|---|
| Size | 31.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e1fb3bc740b27c798fa5d04022422922be8e8c5b9f2aa02e238c64dde48ce2e5
|
|
BLAKE2b-256 checksum How to use checksums |
6bab8f748b238aba4cb7efca5a386452a00b09c682ad0de7a62c4ce7ea1de64c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for retriable-kafka-client 0.7.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.