-
Notifications
You must be signed in to change notification settings - Fork 933
Documentation updates #274
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
Conversation
errors from schema-registry.
flexibility of the parameters.
easily run by cutting and pasting.
|
It looks like @aranaea hasn't signed our Contributor License Agreement, yet.
You can read and sign our full Contributor License Agreement here. Once you've signed reply with Appreciation of efforts, clabot |
|
[clabot:check] |
|
@confluentinc It looks like @aranaea just signed our Contributor License Agreement. 👍 Always at your service, clabot |
|
Tests seem to be failing on something unrelated |
|
I think a newer version of flake8 added more checks, you can ignore it (or file a PR ;) ) |
README.md
Outdated
|
|
||
| avroProducer = AvroProducer({'bootstrap.servers': 'mybroker,mybroker2', 'schema.registry.url': 'http://schem_registry_host:port'}, default_key_schema=key_schema, default_value_schema=value_schema) | ||
| avroProducer.produce(topic='my_topic', value=value, key=key) | ||
| avroProducer = AvroProducer({'bootstrap.servers': 'mybroker,mybroker2', 'schema.registry.url': 'http://schem_registry_host:port'}) |
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.
typo (not yours) : schem_registry_host (missing an a)
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'll update it 👍
| key = {"name": "Key"} | ||
|
|
||
| avroProducer = AvroProducer({'bootstrap.servers': 'mybroker,mybroker2', 'schema.registry.url': 'http://schem_registry_host:port'}, default_key_schema=key_schema, default_value_schema=value_schema) | ||
| avroProducer.produce(topic='my_topic', value=value, key=key) |
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.
why remove default_*_schema args in favour of per-produce-call schema args?
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.
The first thing I was looking to do was send a few messages on a topic. But my topics have multiple messages per topic, so the default_*_schema didn't work for me. I poked around a bit before finding the parameters to the produce call so wanted to capture it in the doc. I'm not sure what the most common use case is but I thought passing the schemas on the produce call was the most flexible.
I'm happy to change this back if you think it makes more sense to use the default schemas.
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.
Sorry for the delay, I think you should change it back to using default schema, since that is what most people will likely be using.
| value_schema = avro.load('ValueSchema.avsc') | ||
| key_schema = avro.load('KeySchema.avsc') | ||
|
|
||
| value_schema_str = """ |
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.
While this is somewhat verbose it is indeed nice with a self-contained examply 👍
edenhill
left a comment
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.
LGTM, just need to change back to default schemas.
| key = {"name": "Key"} | ||
|
|
||
| avroProducer = AvroProducer({'bootstrap.servers': 'mybroker,mybroker2', 'schema.registry.url': 'http://schem_registry_host:port'}, default_key_schema=key_schema, default_value_schema=value_schema) | ||
| avroProducer.produce(topic='my_topic', value=value, key=key) |
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.
Sorry for the delay, I think you should change it back to using default schema, since that is what most people will likely be using.
|
Sorry for the long delay. I've updated the README to include the default schemas. I'm back around se let me know if you want anything else updated. |
I was trying to test out the schema-registry and confluent python libraries and ran into a couple of issues with the README. Just thought I would send them your way.
The main issue was that I received a 409 when trying to run the producer.
I was able to post the same schema to the registry directly, so I knew the schema was actually valid but noticed that in my manual post I had used a different topic name with no '' characters. When I changed this is the sample code everything worked fine. My assumption is that '' is not a valid character as a subject in the schema registry.
I've also included 2 other small changes to the example code. First, I included the schemas as strings in the producer example so that people could just cut and paste without creating the schema separately.
Second, I moved the schema's to be passed in to the call to
produceinstead of as default schemas. This was because a colleague immediately asked about the ability to send multiple message types with associated schemas when I showed her the example code. I just thought this made that capability more clear.