confluent-kafka-go
confluent-kafka-go copied to clipboard
How to produce events to a topic having union-schema
Description
The use-case here is we have a union schema registered on the topic that references all the sub-schemas. Now, it should be something like this: we make an Avro connection with the union schema and then after getting the union schema, resolve all the references from that and use it while publishing the messages, can you please let us know how's this possible to achieve here? How will we get to know which schema has to be used for marshalling the payload while posting the events? Example: Union schema name - user-value [ "com.test.account.user_created", "com.test.account.user_deleted" ]
Sub-schemas: user_created.avro { "fields": [ { "doc": "name of event being published", "name": "event_name", "type": "string" }, { "doc": "unique users reference id", "logicalType": "uuid", "name": "user_ref_id", "type": "string" } ], "name": "user_created", "namespace": "com.test.account", "type": "record", "version": "1" }
{ "fields": [ { "doc": "name of event being published", "name": "event_name", "type": "string" }, { "doc": "unique users reference id", "name": "user_name", "type": "string" } ], "name": "user_deleted", "namespace": "com.test.account", "type": "record", "version": "1" }
Is there any example,how can we do this here?
Checklist
Please provide the following information:
- [ ] confluent-kafka-go and librdkafka version (
LibraryVersion()
): - [ ] Apache Kafka broker version:
- [ ] Client configuration:
ConfigMap{...}
- [ ] Operating system:
- [ ] Provide client logs (with
"debug": ".."
as necessary) - [ ] Provide broker log excerpts
- [ ] Critical issue