I'm consuming Kafka Avro messages using schema registry and facing issues with the key schema being treated as Avro when it's just a string. How can I define a string schema in the schema registry for Kafka Avro messages?
Shun
Asked on Dec 15, 2023
Yes, you can define a string schema in the schema registry for Kafka Avro messages by setting {"type": "string"}
to the key schema.
This will ensure that the key schema is treated as a string and not as Avro, resolving the issue of the key being incorrectly interpreted as Avro.
By defining the key schema as a string, you can avoid the problem of the schema registry trying to fetch a nonexistent schema id for the key.
Example:
{"type": "string"}