-
Notifications
You must be signed in to change notification settings - Fork 55
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
Conversation
setup.py
Outdated
@@ -12,8 +12,11 @@ | |||
readme = readme_file.read() | |||
|
|||
requirements = [ | |||
'javaproperties', | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, remove empty line?
Cool, this looks nice! +1 for adding an example |
from ._serializer import Serializer | ||
|
||
|
||
class AvroHelper: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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.
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.