I want to evolve my AVRO schema with an optional field. I add this on my microservice file (.avsc)
{
"name": "optionalFieldExample",
"type": [
"null",
"string"
]
}
And my topic also have the schema updated with forward compatibility on kafka cluster and the schema-registry is configurated and working on my microservice producer configuration:
In another yaml file I have the configuration that remains unchanged across environments:
When I send a message I have this error:
Error retrieving Avro schema. Schema not found; error code: 40403
If I change my AVRO schema with this:
{
"name": "optionalFieldExample",
"type": [
"null",
{
"type": "string",
"avro.java.string": "String"
}
]
}
The last AVRO schema works. I don't know the reason. Are these two options valid? What do I need to change for the first option to work?
What producer configuration is recommended when setting up an AVRO optional field?
With "use.latest.version: true" this AVRO snippet works:
{
"name": "optionalFieldExample",
"type": [
"null",
"string"
]
}
But I can't apply "use.latest.version = true" because I have many producers, and this setup would require me to update the (.avsc) file all at once instead of updating the producers progressively. However, with "use.latest.version = false", producers can be updated progressively, allowing both updated and non-updated producers to coexist but with this configuration I have the error: Error retrieving Avro schema. Schema not found; error code: 40403.