How does Apicurio registry pick schema version if more than 1 version is uploaded #2894
-
Hello Team, I am exploring Apicurio and had a query, I have a JSON schema which is uploaded in Apicurio version 2.x. Note: I am using spring boot, Kafka and apicurio registry 2.x with JSON validation |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @junaidaj86 sorry for the late response. A few things to answer here. First, Apicurio Registry does not perform validation on the server. Validation always occurs on the client side. Typically that means the Serializer/Deserializer code in a typical Kafka application. The way this usually works is that the producer Kafka application uses a particular schema version to produce a message on a Kafka topic. The unique ID of that specific schema version is included in the Kafka message, either as a header or as the first 4 or 8 bytes of the message payload. Next, when a consumer Kafka application reads the message, it determines the unique schema ID by reading it from the message. It then uses that unique ID to lookup the schema version in the registry. Then it uses that schema to either deserialize or validate the message body. The question then is how does the producer application know what version of a schema to use. That depends on how you want to do it.
As far as the Apicurio Registry server is concerned, every version of a schema is unique and has unique coordinates. It can be identified in one of these ways:
Every registry artifact may consist of multiple versions. The |
Beta Was this translation helpful? Give feedback.
Hi @junaidaj86 sorry for the late response.
A few things to answer here.
First, Apicurio Registry does not perform validation on the server. Validation always occurs on the client side. Typically that means the Serializer/Deserializer code in a typical Kafka application.
The way this usually works is that the producer Kafka application uses a particular schema version to produce a message on a Kafka topic. The unique ID of that specific schema version is included in the Kafka message, either as a header or as the first 4 or 8 bytes of the message payload. Next, when a consumer Kafka application reads the message, it determines the unique schema ID by reading it from the message. It then u…