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

Installing

pip install kakfa-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.0.3.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

kafka_schema_registry-0.0.3-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file kafka-schema-registry-0.0.3.tar.gz.

File metadata

  • Download URL: kafka-schema-registry-0.0.3.tar.gz
  • Upload date:
  • Size: 5.2 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.2 CPython/3.9.5

File hashes

Hashes for kafka-schema-registry-0.0.3.tar.gz
Algorithm Hash digest
SHA256 878e87c563721345f88a1ec9e2ec8bff9cc20554a2940fc7aa1173dbfbc66e06
MD5 d5560c2e0d80cadab0c5141f00ae88d2
BLAKE2b-256 dac0bbb101011189a8e76a628caa28d569cef0e64aedb2136ed38c75439844b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kafka_schema_registry-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.5 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.2 CPython/3.9.5

File hashes

Hashes for kafka_schema_registry-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d451b6ad4ac61dfb6b29e86b9682f623489c70124d81a9add941f3dbf082aee3
MD5 da2f96388ea95d31f694321f085c2abe
BLAKE2b-256 f532ba82a0549c4051c405c45f5841056a686f30b6899609d7d5e5bf660e884d

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