Hi Team,
i have setup Confluent Platform 6.1.0 locally using Docker Images. I have setup topic in Control Center and added AVRO Schema for the topic. Below is the Schema.
{
“fields”: [
{
“name”: “partyIdentifier”,
“type”: “string”
},
{
“doc”: “Party First name.”,
“name”: “partyName1”,
“type”: “string”
},
{
“doc”: “Party Middle Name.”,
“name”: “partyName2”,
“type”: “string”
},
{
“doc”: “Party Last Name.”,
“name”: “partyName3”,
“type”: “string”
},
{
“name”: “PartyAddress”,
“type”: [
“null”,
{
“fields”: [
{
“name”: “Address1”,
“type”: “string”
},
{
“name”: “Address2”,
“type”: “string”
}
],
“name”: “PartyAddress”,
“type”: “record”
}
]
}
],
“name”: “Party”,
“namespace”: “Confluent.Kafka.Model.ClientSpecific”,
“type”: “record”
}
When i am trying to publish message to the topic getting following error
{
“error_code”: 42203,
“message”: “Conversion of JSON to Object failed: Failed to convert JSON to Avro: Unknown union branch Address1”
}
Am using Rest Proxy to publish message. Below is the message i am passing
{
“records”: [
{
“value”: {
“partyIdentifier”: “1312323”,
“partyName1”: “Nishanth”,
“partyName2”: “”,
“partyName3”: “P”,
“PartyAddress”: {
“Address1”: {
“string”: “Test”
},
“Address2”: {
“string”: “Test”
}
}
}
}
],
“value_schema”: “{\n "doc": "Sample schema to help you get started.",\n "fields": [\n {\n "doc": "The string type is a unicode character sequence.",\n "name": "partyIdentifier",\n "type": "string"\n },\n {\n "doc": "Party First name.",\n "name": "partyName1",\n "type": "string"\n },\n {\n "doc": "Party Middle Name.",\n "name": "partyName2",\n "type": "string"\n },\n {\n "doc": "Party Last Name.",\n "name": "partyName3",\n "type": "string"\n },\n {\n "name": "PartyAddress",\n "type": [\n "null",\n {\n "name": "PartyAddress",\n "namespace": "Confluent.Kafka.Model.ClientSpecific",\n "type": "record",\n "fields": [\n {\n "name": "Address1",\n "type": "string"\n },\n {\n "name": "Address2",\n "type": "string"\n }\n ]\n }\n ]\n }\n ],\n "name": "Party",\n "namespace": "Confluent.Kafka.Model.ClientSpecific",\n "type": "record"\n}”
}
If i pass null to PartyAddress, its working. if i pass record type getting Unknown union branch error. Please help me to resolve the issue.
Thanks,
Nishanth P