-
Notifications
You must be signed in to change notification settings - Fork 97
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
MSK Java producer/consumer with both key and value in AVRO and using glue schema registry #234
Comments
Duplicates #93 |
@OneCricketeer , I guess my issue is slightly different.
|
Can you please explain why you think you'll need two complete separate Registry servers? Topics exist in one Kafka cluster. Only one Registry should be associated with that cluster. (note: nothing would prevent you from setting My point was that you can already set different schema names in one cluster / registry |
I wont need two different registries if the schema names are fixed. |
Clarify what you mean by "fixed". They are "fixed (to static values)" if you use Only Confluent defaults to use |
OK, I thought #93 is still not resolved. |
It is;
That is true, but you can set a whitelist for a single table at a time. Deploy multiple connector configs rather than capture all tables (that pattern will actually scale better because errors are limited to one table at a time, and Kafka producers in each connector only need to write to one topic). Otherwise, yeah, subclassing the subject naming strategy is what you want. As mentioned before, you'd set those properties into |
Thanks @OneCricketeer I would imaging the CDC connector for each table is going to be inefficient.. As the connectors have to read the same logs many times. So overriding the class would work for schema name and by specifying the key.converter.schemaNameGenerationClass and value.converter.schemaNameGenerationClass parameters. However how would you read this topic thru a Java consumer? So this goes back to original question..
|
You'd need to use Copy the class/dependency between the Connect workers and consumers |
OK.. Thats in the AWSSchemaRegistryConstants.. |
@OneCricketeer this works great.. Thanks again for helping me out here. For reference, this is what I did. In the common project create a custom class
On the MSK Connect I set the following parameters
This will create topics for each table with appropriate schemas then the java consumer will look similar to
|
Looks great. Feel free to close the issue. |
0
I am trying to use the MSK connect Mysql CDC connector with both key and value as AVRO schemas using Glue Schema registry (GSR).
When I was doing this using confluent schema registry, the schema name for both key and value will be something like serverName.schemaName.tableName_key and serverName.schemaName.tableName_value.
But when I use the GSR both key and value schemas are coming out as serverName.schemaName.tableName and hence try to overwrite each schema and it fails.
So workaround I figured out was to use two different registries for key and value and it works. I was also able to read the topics using JDBC sink connector.
However I was not able to figure out how to write a simple java producer/consumer to write/read the topic that key and value both are AVRO and use two different registries for key and value schema.
I looked at the code in GSR github, but there are only one registry name and one schema name in the AWSSchemaRegistryConstants class, so not sure how to pass two different registries and schemas. I appreciate any examples. https://github.com/awslabs/aws-glue-schema-registry/blob/master/common/src/main/java/com/amazonaws/services/schemaregistry/utils/AWSSchemaRegistryConstants.java
The text was updated successfully, but these errors were encountered: