Kafka and schema registry integration
Project description
kafka-schema-registry
This library allows you to create topics on Kafka topics, associated with a Confluent Schema Registry, and publish messages on them.
It takes care of:
- creating the topic
- publishing the associated schema (or updating an existing one)
- serializing and publishing messages to Kafka
It works with kafka-python, and extra arguments are forwarded to it.
Installing
pip install kafka-schema-registry
Usage
from kafka_schema_registry import prepare_producer
SAMPLE_SCHEMA = {
"type": "record",
"name": "TestType",
"fields" : [
{"name": "age", "type": "int"},
{"name": "name", "type": ["null", "string"]}
]
}
producer = prepare_producer(
['localhost:9092'],
f'http://schemaregistry',
topic_name,
1,
1,
value_schema=SAMPLE_SCHEMA,
)
producer.send(topic_name, {'age': 34})
producer.send(topic_name, {'age': 9000, 'name': 'john'})
Running the tests
The test requires Docker in order to start a local Redpanda instance.
make start-redpandato start the servermake testto configure a virtualenv and run the tests
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kafka-schema-registry-0.1.2.tar.gz.
File metadata
- Download URL: kafka-schema-registry-0.1.2.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.12.0 pkginfo/1.8.3 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a68fe5aab6c69ceadc8399498ac2ff6582aec7fa53fb4af10f8722f0732882d
|
|
| MD5 |
63a89e9c2ba2dd5cd4923de605d50ef3
|
|
| BLAKE2b-256 |
2257096ebff00431d2b05ee1b9cff460c721a332564035abea223d60d91d9e9b
|
File details
Details for the file kafka_schema_registry-0.1.2-py3-none-any.whl.
File metadata
- Download URL: kafka_schema_registry-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.12.0 pkginfo/1.8.3 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bc1d2ec8ccdd8575d348d486d912ac7778b8b674b2a0c73b0709a8186ca48c4
|
|
| MD5 |
729ef6b2b2752df9b26890f0be5e7919
|
|
| BLAKE2b-256 |
9b4fcb78b2cd975fe14357af1a78627b8e32e4d65c37261ed765a471744af545
|