Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Avro Schema Registry #42

Merged
merged 6 commits into from
Jan 2, 2018
Merged

Conversation

sambott
Copy link
Contributor

@sambott sambott commented Dec 28, 2017

Fixes #33

This adds a basic Serde using the existing confluent-kafka-python package.

Currently this is only tested as an isolated serde with a mocked Schema Registry. I think it would be worth adding an example that uses this to get some integration testing and catch bugs early -- I've added #41 for this.

@sambott sambott requested review from llawall, ah- and jhickson December 28, 2017 16:07
setup.py Outdated
@@ -12,8 +12,11 @@
readme = readme_file.read()

requirements = [
'javaproperties',

Copy link
Contributor

Choose a reason for hiding this comment

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

Minor, remove empty line?

@ah-
Copy link
Contributor

ah- commented Dec 31, 2017

Cool, this looks nice!
Schema registry is so useful.

+1 for adding an example

@sambott sambott merged commit a05037a into wintoncode:master Jan 2, 2018
from ._serializer import Serializer


class AvroHelper:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a better name would be AvroSerde as it's not so much a helper as the whole implementation.

Can I take it the reason to have both serialisation and deserialisation centralised here is because configuration is common?

Copy link
Contributor

Choose a reason for hiding this comment

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

I've now seen there's a AvroSerde below. Perhaps AvroSerdeImpl instead of AvroHelper then.

if schema:
self._schema = avro_loads(schema)

def serialize(self, topic, data):
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be better both here and in deserilize to have a guard that self._serializer != None? That way a meaningful error message could be emitted saying that configure should be called first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants