Skip to main content

Apicurio schema registry

Our managed Event Streaming service comes with a shiped in schema registry. We are using the Apicurio registry

What is a schema registry?

A Schema Registry in the context of Apache Kafka is a central repository for storing the metadata about the structure (schema) of the data that gets transmitted through Kafka topics. It can be an integral part of a Kafka-based data pipeline, especially when dealing with structured data that's serialized, such as Avro or Protobuf data.

Here is a high-level overview of how a Schema Registry works:

  1. Schema Definition: The producer application first defines the schema of the data it's going to send. This schema is a structured description of the data fields and their types. The schema could be in JSON format, Avro format, or any other format based on the needs of the system.

  2. Schema Registration: Once the schema is defined, the producer registers this schema with the Schema Registry. The Schema Registry validates the schema, assigns it a unique identifier (also known as the schema ID), and stores the schema-ID pair.

  3. Sending Data: When the producer application sends data, it includes the schema ID with the message. The actual data is serialized according to the schema definition (which means it's transformed into a format suitable for efficient transmission and storage).

  4. Receiving Data: On the consumer side, when data arrives, it will have the schema ID attached. The consumer application queries the Schema Registry for the schema associated with that ID. Using the fetched schema, the consumer application can then deserialize the data, turning it back into a structured format it can use.

  5. Schema Evolution: Over time, the structure of the data might change. In that case, a new version of the schema needs to be registered with the Schema Registry. The Schema Registry helps to handle this schema evolution, enforcing compatibility rules (which can be set according to the needs of the system, e.g., backward, forward, or full compatibility) to make sure the change does not break the existing data processing system.

Using a Schema Registry in this way, Kafka-based systems can handle complex, evolving structured data across different applications, enforcing data consistency, and reducing the risk of data corruption or misunderstanding.