Skip to content

pienio7/python-kafka-rest-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Kafka REST Client

Convenience wrapper for Kafka REST proxy

Intallation

  • TODO: upload to pypi
pip install git+https://github.com/bergundy/python-kafka-rest-client

Producer Example

from kafka_rest_client import JsonProducer

producer = JsonProducer()

for x in range(10):
    producer.produce('my_topic', str(x))

Consumer Example

from kafka_rest_client import Client

client = Client()

message_format = 'json'  # or 'avro' / 'binary'

with client.create_consumer('example_group', message_format, offset_reset='smallest') as consumer:
    for m in consumer.messages('my_topic'):
        print m['key'], m['value']

Avro Producer

from kafka_rest_client import AvroProducer

key_schema = { ... }
value_schema = { ... }

producer = AvroProducer(hosts, key_schema=key_schema, value_schema=value_schema)
producer.produce('avro_topic', {'key': { ... }, 'value': { ... })

About

Convenience wrapper for rest proxy API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%