Skip to content
This repository has been archived by the owner on Apr 1, 2021. It is now read-only.

Make provision for passing custom serialisers in woof producer #15

Merged
merged 2 commits into from
May 19, 2017

Conversation

sudev
Copy link

@sudev sudev commented May 9, 2017

This patch will help anyone to write custom de-serialisation/serialisation protocols and produce binary data to Kafka.

Say you want to deal with msg pack and not UTF-8.

# Producer 
producer = KafkaProducer(value_serializer=msgpack.dumps)
producer.send('msgpack-topic', {'key': 'value'})

# Consumer 
consumer = KafkaConsumer(value_deserializer=msgpack.unpackb)
for msg in consumer:
     do_something(msg) # here msg is de-serialised to python data structures.

FYI - We wrote make_safe earlier to stop anyone from producing non utf-8 string, now we will keep this as default but will allow anyone to override it.

@sudev sudev self-assigned this May 9, 2017
@sudev sudev requested a review from vikalp May 9, 2017 13:37
@sudev sudev changed the title Make provision for passing custom serialsers in woof producer Make provision for passing custom serialisers in woof producer May 9, 2017
@sudev sudev requested review from amritjangid and removed request for amritjangid May 10, 2017 09:34
Copy link

@ashu- ashu- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@sudev sudev merged commit 5857189 into master May 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants