Skip to main content

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-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.1.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

kafka_schema_registry-0.1.2-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

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

Hashes for kafka-schema-registry-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9a68fe5aab6c69ceadc8399498ac2ff6582aec7fa53fb4af10f8722f0732882d
MD5 63a89e9c2ba2dd5cd4923de605d50ef3
BLAKE2b-256 2257096ebff00431d2b05ee1b9cff460c721a332564035abea223d60d91d9e9b

See more details on using hashes here.

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

Hashes for kafka_schema_registry-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7bc1d2ec8ccdd8575d348d486d912ac7778b8b674b2a0c73b0709a8186ca48c4
MD5 729ef6b2b2752df9b26890f0be5e7919
BLAKE2b-256 9b4fcb78b2cd975fe14357af1a78627b8e32e4d65c37261ed765a471744af545

See more details on using hashes here.

Supported by

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