Reputation: 441
I'm working with the Kafka CLI. I'm using the command kafka-avro-console-producer
to produce a record to a topic.
This is the schema:
{
"connect.name": "datachanges.article.Envelope",
"name": "Envelope",
"namespace": "datachanges.article",
"type": "record",
"fields": [
{
"default": null,
"name": "before",
"type": [
"null",
{
"connect.name": "datachanges.article.Value",
"name": "Value",
"type": "record",
"fields": [
{ "name": "id", "type": "int" }
]
}
]
}
]
}
And this is the test data:
{ "before": { "id": 345530 } }
I keep getting the error:
org.apache.avro.AvroTypeException: Unknown union branch id
I get the same error with this payload:
{ "before": { "id": { "int": 345530 } } }
Please mind that I cannot change the schema, because it is automatically generated by the Debezium connector.
I have read this post, but the solution doesn't work for me: org.apache.avro.AvroTypeException: Unknown union branch
Thank you.
Upvotes: 0
Views: 2480
Reputation: 768
Your input should be something like this.
{
"before": {
"Value": {
"id": {
"int": 345530
}
}
}
}
or
{
"before": {
"Value": {
"id": 345530
}
}
}
Upvotes: 1