Skip to main content

Kafka and schema registry integration

Project description

kafka-schema-registry

This library allows you to create topics on Kafka associated with a Confluent schema, 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

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'})

Run the test

The test requires Docker in order to start a local Redpanda instance.

  • make start-redpanda to start the server
  • make test to 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

kafka_schema_registry-0.0.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

kafka_schema_registry-0.0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file kafka_schema_registry-0.0.1.tar.gz.

File metadata

  • Download URL: kafka_schema_registry-0.0.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.2

File hashes

Hashes for kafka_schema_registry-0.0.1.tar.gz
Algorithm Hash digest
SHA256 dd1f243759e48a3c43c5acfdb7a7585d4348f29d22f43ffd305b317da94c359c
MD5 c8c0c226aa3c7b569f44887059215289
BLAKE2b-256 663a77d918573738a851a89bc188439ec3a87cb72ba14fbbc0519734c6763513

See more details on using hashes here.

File details

Details for the file kafka_schema_registry-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: kafka_schema_registry-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.2

File hashes

Hashes for kafka_schema_registry-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 99c0237a157f532c9af13f2d905a3306d458fcac3ca9571a2662cd9b1a97d256
MD5 5d284defde90a13843a037a1332e9263
BLAKE2b-256 78a5a9ead178984b19cc5c2292e72e19611a9c1d8ea58bcbb16980c0d5d7e2ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page