Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Reason given by maintainers: archived

Confluent Kafka Config

A thin wrapper around the confluent-kafka-python library. This wrapper allows for dynamic instantiation of Consumer, Producer, and Admin clients based on configurations provided in a config file in YAML or JSON formats.

Installation

To install this package, run:

pip install confluent_kafka_config

Structure of config file

admin
   └── config
       └── bootstrap.servers:  < host:port >
schema_registry
   └── url:                    < http's://host:port >

consumers < list of dictionaries >
   ├── name:                   < some consumer name, random >
   ├── topic 
   │   ├── name:               < topic name >
   │   ├── partitions:         < a list of partition numbers to consume from, or leave empty >
   │   └── schema_name:        < schema name to use with topic >
   └── config                  < confluent_kafka.Consumer conf >
       ├── bootstrap.servers:  < host:port >
       ├── group.id:           < group name >
       └── ...
       
producers < list of dictionaries >                 
   ├── name:                   < some producer name, random >
   ├── topic 
   │   ├── name:               < topic name >
   │   ├── partitions:         < a list of partition numbers to produce to, or leave empty >
   │   └── schema_name:        < schema name to use with topic >
   └── config                  < confluent_kafka.Producer conf >
       ├── bootstrap.servers:  < host:port >
       ├── acks:               < 0, 1, etc. >
       └── ...

Docs:

Definitions:

  • Client: Either an instance of ProducerContext or ConsumerContext

⚠️ Warning: At present, each client expects a single topic with single schema. This will be resolved in the future: https://github.com/Aragonski97/confluent-kafka-config/issues/16

ClientPool

A wrapper class that contains all consumers / producers instantiated based on config file. Load ClientPool by calling its class factory function:

from confluent_kafka_config.client_pool import ClientPool

pool = ClientPool.from_config(<path_to_your_config_file>)

# access consumers
#pool.consumers : dict[str, ConsumerContext]

# access producers
#pool.producers: dict[str, ProducerContext]

# get specific consumer by name is pool.consumers[<consumer name>]
# same for producers
# overriden __getitem__ will be implemented in the future: https://github.com/Aragonski97/confluent-kafka-config/issues/15

RegistryContext

A wrapper around confluent_kafka.SchemaRegistryClient that includes the given schema indended for a client specified in config file. Based on the schema, a function confluent_kafka_config.RegistryContext.create_registered_model creates a model based on the schema definied in the registry. This model is used for deserialization and serialization.

TopicContext

A wrapper around confluent_kafka.TopicPartition class that includes not only the topic name and partitions, but also a registered schema specified in the config file.

ConsumerContext

A wrapper around confluent_kafka.Consumer class that includes a given confluent_kafka_config.TopicContext. The function confluent_kafka_config.ConsumerContext.consume is an exposed version of confluent_kafka.Consumer.consume which handles some errors. This error handling will be extensively covered in the future: https://github.com/Aragonski97/confluent-kafka-config/issues/17

ProducerContext

Almost identical to ConsumerContext, just pertaining confluent_kafka.Producer class.

KafkaConfig

A pydantic schema used for loading the config file. Embedded validation, etc.

Metadata

Release files for confluent-kafka-config 1.1.4

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

Source distribution (sdist)

Source distribution for confluent-kafka-config 1.1.4
File Size Uploaded
confluent_kafka_config-1.1.4.tar.gz 17.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for confluent-kafka-config 1.1.4
File Interpreter ABI Platform
confluent_kafka_config-1.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 39.2 kB

Release files / confluent_kafka_config-1.1.4.tar.gz

Download URL confluent_kafka_config-1.1.4.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
306e2df9497964759b826677b0810c9531b4abe40f226047786f2bc9b9b2a92b
BLAKE2b-256 checksum
How to use checksums
94ef597b3d867acb0ada04dcbbd0df744a8abcf5b776ce7174f4632a8c0a7ba4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Release files / confluent_kafka_config-1.1.4-py3-none-any.whl

Download URL confluent_kafka_config-1.1.4-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51438abdf2a85a915abcaf9e444e1641df338841fd045ef23607db1bd612e12f
BLAKE2b-256 checksum
How to use checksums
560b632431d9d3ec301d30734d2d349415a6cb7113481b324c4423b70185e16d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.1.4 This release

2 release files

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