We have been using Confluent Schema Registry with KafkaStreams for over a year now and everything has been working well; until yesterday.
In an UAT environment we seem to have had a Schema subject deleted and one of our applications started failing over with the message
[ERROR] LogAndFailExceptionHandler - Exception caught during Deserialization, taskId: 0_13, topic: TOPIC_NAME, partition: 13, offset: 0 org.apache.kafka.common.errors.SerializationException: Error retrieving Avro schema for id 1531
I checked the Schema Registry and noticed the subject was missing and queries the id 1531 that is listed in the error with curl such as:
curl -X GET http://SchemaRegistryHost:8081/schemas/ids/1531
And got back:
{"error_code":40403,"message":"Schema not found"}
I naively just tried to register the schema again without thinking about it and it worked but the id the schema was registered with was not the same as the previous 1531 ID.
I need the schema registered to the ID 1531 since the existing messages in the topic already contain that Id 1531 in the magic byte.
I checked the API docs at https://docs.confluent.io/current/schema-registry/docs/develop/api.html but did not see anything for setting a given Id for a schema.
Is there anyway to force a schema to a specific Id with schema registry?
I am aware of some backup solutions but I am looking for a fix now that will hopefully prevent loss of data or extraordinary measures to fix the topic data.