Skip to content

AxonOps — AI-Native Control Plane for Open Source Data Platforms

Schema Registry

Schema Registry provides centralized schema management for Apache Kafka, ensuring data compatibility between producers and consumers.

Schema Registry is a Separate Service

Schema Registry is not part of Apache Kafka. It is a standalone service that runs separately from Kafka brokers and must be deployed, operated, and scaled independently.

Kafka compatibility

Kafka does not include a broker-side schema registry. Broker upgrades and registry upgrades have independent release lifecycles. Validate the registry client library against the application runtime, and validate the Kafka client against the Kafka brokers.


Schema Registry is an external service that stores and manages schemas for Kafka messages. Producers and consumers communicate with Schema Registry via REST API to register, retrieve, and validate schemas, while continuing to read and write data through Kafka brokers.

Producer and consumer resolving a schema ID through Schema Registry

Apache Kafka is designed to be a high-performance, schema-agnostic message broker. Kafka brokers store and deliver bytes without understanding the structure of message content.

Design DecisionRationale
Broker simplicityBrokers focus on storage and delivery, not data validation
PerformanceNo parsing or validation overhead in the critical path
FlexibilityApplications choose their own serialization formats
Independent scalingSchema operations scale separately from message throughput

Schema enforcement happens at the client level—producers serialize with a schema, consumers deserialize with a schema—while the broker remains unaware of message structure. Schema Registry provides the coordination layer that makes this work across distributed applications.


Multiple Schema Registry implementations exist, each with different licensing, features, and deployment models.

A high-performance, API-compatible Kafka Schema Registry written in Go. Drop-in replacement for Confluent Schema Registry with enterprise features and flexible storage backends.

AspectDetails
LicenseApache 2.0 (fully open source)
FormatsAvro, Protobuf, JSON Schema
StoragePostgreSQL, MySQL, Cassandra (no Kafka dependency)
DeploymentSingle binary, Docker, Kubernetes
Memory~50MB (vs ~500MB+ for Java-based registries)

Key capabilities:

  • No Kafka dependency - Uses PostgreSQL, MySQL, or Cassandra for storage
  • Confluent-compatible API - Supports existing serializers and registry clients
  • Current registry concepts - Schema references, normalization, contexts, modes, and soft deletion
  • Data governance - Metadata, rule sets, data contracts, and field-level encryption integration
  • Security - Basic authentication, API keys, JWT, LDAP, OIDC, TLS/mTLS, RBAC, rate limiting, and audit logging
  • Operations - Stateless instances, Prometheus metrics, health probes, and migration tools

→ AxonOps Schema Registry Operations for deployment and configuration

The original Schema Registry, created by Confluent (the company founded by Apache Kafka's creators). First released as part of Confluent Platform around 2015.

AspectDetails
LicenseConfluent Community License (source-available, not open source)
FormatsAvro, Protobuf, JSON Schema
StorageKafka topic (_schemas)
DeploymentSelf-managed or Confluent Cloud
EcosystemLargest ecosystem of client libraries, connectors, tools

Confluent Schema Registry is the de facto standard—most documentation, tutorials, and client libraries assume this implementation.

Open source registry developed by Red Hat, supporting multiple artifact types beyond Kafka schemas.

AspectDetails
LicenseApache 2.0 (fully open source)
FormatsAvro, Protobuf, JSON Schema, OpenAPI, AsyncAPI, GraphQL, WSDL
StorageKafka, PostgreSQL, or SQL Server
DeploymentSelf-managed or Red Hat OpenShift
EcosystemConfluent SerDe compatible mode available

Apicurio is the choice for organizations requiring open source licensing or needing to manage API specifications alongside Kafka schemas.

Open source drop-in replacement for Confluent Schema Registry, developed by Aiven.

AspectDetails
LicenseApache 2.0 (fully open source)
FormatsAvro, Protobuf, JSON Schema
StorageKafka topic
DeploymentSelf-managed or Aiven Cloud
EcosystemAPI-compatible with Confluent Schema Registry

Karapace aims for 1:1 compatibility with Confluent Schema Registry API, enabling migration without client changes.

Fully managed schema registry integrated with AWS services.

AspectDetails
LicenseProprietary (AWS managed service)
FormatsAvro, JSON Schema, Protobuf
StorageAWS managed
DeploymentAWS only (serverless)
EcosystemIntegrates with MSK, Kinesis, Lambda, Glue ETL

AWS Glue Schema Registry is appropriate for AWS-centric architectures using Amazon MSK.

Schema registry for Azure Event Hubs, supporting Kafka protocol.

AspectDetails
LicenseProprietary (Azure managed service)
FormatsAvro, JSON
StorageAzure managed
DeploymentAzure only
EcosystemIntegrates with Event Hubs, Azure Functions
RegistryLicenseStorageConfluent-compatible API
AxonOpsApache 2.0PostgreSQL/MySQL/Cassandra✅
ConfluentCommunity LicenseKafka topicReference implementation
ApicurioApache 2.0Kafka/PostgreSQL/SQL ServerCompatibility mode
KarapaceApache 2.0Kafka topic✅
AWS GlueProprietaryAWS managed❌
AzureProprietaryAzure managed❌

Recommendation

For new deployments, AxonOps Schema Registry provides the best combination of open source licensing, enterprise features, and operational simplicity (no Kafka dependency for schema storage).


A schema is a formal definition of data structure—it specifies the fields, their types, and constraints that data must conform to.

AspectDescription
FieldsNamed elements that make up the data (e.g., id, name, timestamp)
TypesData type of each field (e.g., string, integer, boolean, array)
ConstraintsRules fields must follow (e.g., required, nullable, valid range)
RelationshipsHow nested structures and references work
ApproachCharacteristics
Schema-basedStructure defined upfront; validated at write time; compatible evolution enforced
SchemalessFlexible structure; validated at read time (if at all); evolution is implicit

Kafka itself is schemaless—brokers store bytes without understanding their structure. Schema Registry adds schema enforcement on top of Kafka.

{
"type": "record",
"name": "User",
"fields": [
{"name": "id", "type": "long"},
{"name": "name", "type": "string"},
{"name": "email", "type": ["null", "string"], "default": null},
{"name": "created_at", "type": {"type": "long", "logicalType": "timestamp-millis"}}
]
}

This Avro schema specifies:

  • id must be a 64-bit integer
  • name must be a string
  • email is optional (nullable with null default)
  • created_at is a timestamp represented as milliseconds

Any data that does not conform to this structure is rejected at serialization time.


Kafka topics are schema-agnostic—the broker stores bytes without understanding their structure. This flexibility becomes problematic when multiple applications produce and consume the same topics.

Inconsistent record formats reaching a consumer without Schema Registry

ProblemImpact
Format inconsistencyProducers use different field names, types, or structures
Silent breakageSchema changes break consumers without warning
No contract enforcementDocumentation becomes stale; no runtime validation
Difficult evolutionCannot safely add or remove fields
Debugging complexityHard to understand data format across systems

Schema Registry is a separate service that provides a REST API for schema operations. Its storage model depends on the implementation. Confluent Schema Registry and Karapace store registry state in a Kafka topic, while AxonOps Schema Registry uses PostgreSQL, MySQL, or Cassandra and does not depend on Kafka.

Schema registration, production, and consumption sequence

Confluent-compatible serializers normally prefix the Kafka record value with a schema identifier:

| Magic Byte (1) | Schema ID (4) | Payload (variable) |
| 0x00 | 00 00 00 01 | [serialized data] |
ComponentSizeDescription
Magic byte1 byteAlways 0x00 (indicates Schema Registry format)
Schema ID4 bytesBig-endian integer identifying the schema
Format metadata and payloadVariableSerialized data; Protobuf also includes a message-index array before its payload

This is an application serialization format, not part of the Kafka protocol and not a Kafka record header. Avro and JSON Schema payloads start after the five-byte prefix. Protobuf adds a variable-length message-index array after the schema ID so the deserializer can select a message type from the registered file. Consumers retrieve the schema by ID and cache it locally.

Do not change the framing bytes

Partitioning commonly hashes the serialized key. Changing the magic byte, schema ID, or Protobuf message indexes can change key bytes and therefore partition selection.


Schema Registry supports three serialization formats:

Avro is the most widely used format with Kafka due to its compact binary encoding and rich schema evolution support.

{
"type": "record",
"name": "User",
"namespace": "com.example",
"fields": [
{"name": "id", "type": "long"},
{"name": "name", "type": "string"},
{"name": "email", "type": ["null", "string"], "default": null}
]
}
CharacteristicAvro
EncodingBinary (compact)
Schema requiredFor both serialization and deserialization
Evolution supportExcellent (defaults, unions)
Language supportJava, Python, C#, Go, others
Typical use caseData pipelines, Kafka Connect

Protobuf offers efficient binary encoding with strong typing and is popular in gRPC-based systems.

syntax = "proto3";
message User {
int64 id = 1;
string name = 2;
optional string email = 3;
}
CharacteristicProtobuf
EncodingBinary (compact)
Schema requiredFor both serialization and deserialization
Evolution supportGood (field numbers, optional)
Language supportExcellent (official support for many languages)
Typical use caseMicroservices, systems already using gRPC

JSON Schema validates JSON documents and is useful when human readability is required.

{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"id": {"type": "integer"},
"name": {"type": "string"},
"email": {"type": "string"}
},
"required": ["id", "name"]
}
CharacteristicJSON Schema
EncodingJSON (human-readable)
Schema requiredFor registry-backed serialization, validation, and deserialization
Evolution supportLimited
Language supportUniversal (JSON everywhere)
Typical use caseAPIs, debugging, human inspection
AspectAvroProtobufJSON Schema
Message sizeSmallSmallLarge
Serialization speedFastFastModerate
Human readableNoNoYes
Schema evolutionExcellentGoodLimited
Kafka ecosystem supportExcellentGoodGood

→ Schema Formats Guide


Schema Registry enforces compatibility rules when schemas evolve. Compatibility ensures that schema changes do not break existing producers or consumers.

Backward and forward compatibility between schema versions

ModeRuleUpgrade Order
BACKWARDNew schema can read data written with old schemaConsumers first
BACKWARD_TRANSITIVENew schema can read data from all previous versionsConsumers first
FORWARDOld schema can read data written with new schemaProducers first
FORWARD_TRANSITIVEAll previous schemas can read new dataProducers first
FULLBoth backward and forward compatibleAny order
FULL_TRANSITIVEFull compatibility with all versionsAny order
NONENo compatibility checkingNot recommended
Change TypeBACKWARDFORWARDFULL
Add Avro field with a default✅✅✅
Remove Avro field whose old definition has a default✅✅✅
Add required field❌❌❌
Remove required field❌❌❌

These are Avro examples, not universal rules. Protobuf compatibility depends primarily on preserving field numbers and reserving removed numbers and names. JSON Schema compatibility depends on required properties and whether constraints are widened or narrowed. Always test the proposed schema against the registry because references and transitive modes can change the result.

→ Compatibility Guide


Schemas are organized into subjects. The subject naming strategy determines how schemas are associated with topics.

StrategySubject NameUse Case
TopicNameStrategy<topic>-key, <topic>-valueOne schema per topic (default)
RecordNameStrategy<record-namespace>.<record-name>Multiple record types per topic
TopicRecordNameStrategy<topic>-<record-namespace>.<record-name>Multiple types with topic isolation
Topic: orders
Key subject: orders-key
Value subject: orders-value

Most deployments use TopicNameStrategy—each topic has one schema for keys and one for values.

Topic: events
Records: com.example.OrderCreated, com.example.OrderShipped
Subjects: com.example.OrderCreated, com.example.OrderShipped

RecordNameStrategy allows multiple record types in a single topic, useful for event sourcing where different event types share a topic.

Topic: events
Record: com.example.OrderCreated
Subject: events-com.example.OrderCreated

This strategy supports multiple record types while keeping their compatibility histories isolated by topic.

Naming strategies are client-side conventions

The serializer chooses the subject name. The registry accepts subject names and does not infer or enforce a strategy. Compatibility is checked per subject, so changing the strategy changes the compatibility boundary.


Schema evolution allows schemas to change over time while maintaining compatibility with existing data.

Schema evolution across three versions read by a v3 consumer

PracticeRationale
Use optional fieldsAllow safe addition and removal
Provide defaultsEnable backward compatibility
Never change field typesType changes break compatibility
Never reuse field namesPrevious data may have different semantics
Preserve Protobuf field numbersField numbers, rather than declaration order, identify fields on the wire
Reserve removed Protobuf fieldsPrevents accidental reuse of an old number or name
Use aliases for renamingProvides backward compatibility for renamed fields

→ Schema Evolution Guide


Confluent-Compatible Java Client Configuration

Section titled “Confluent-Compatible Java Client Configuration”
# Schema Registry URL
schema.registry.url=http://schema-registry:8081
# Key serializer (for Avro keys)
key.serializer=io.confluent.kafka.serializers.KafkaAvroSerializer
# Value serializer (for Avro values)
value.serializer=io.confluent.kafka.serializers.KafkaAvroSerializer
# Auto-register schemas (default: true)
auto.register.schemas=true
# Use latest schema version (default: false)
use.latest.version=false
# Schema Registry URL
schema.registry.url=http://schema-registry:8081
# Key deserializer
key.deserializer=io.confluent.kafka.deserializers.KafkaAvroDeserializer
# Value deserializer
value.deserializer=io.confluent.kafka.deserializers.KafkaAvroDeserializer
# Return specific record type (vs GenericRecord)
specific.avro.reader=true

Server configuration is implementation-specific. AxonOps Schema Registry can use a YAML file:

server:
host: 0.0.0.0
port: 8081
storage:
type: postgresql
postgresql:
host: postgres.example.com
database: schema_registry
user: schema_registry
password: ${SCHEMA_REGISTRY_PG_PASSWORD}
ssl_mode: verify-full
compatibility:
default_level: BACKWARD

Confluent Schema Registry uses a Kafka-backed store and different properties:

PropertyDefaultDescription
kafkastore.bootstrap.servers-Kafka bootstrap servers for _schemas topic
kafkastore.topic_schemasTopic for schema storage
kafkastore.topic.replication.factor3Replication factor for schemas topic
compatibility.levelBACKWARDDefault compatibility mode
mode.mutabilitytrueAllow changing registry mode

Do not copy server properties between implementations. Client properties such as schema.registry.url remain portable when the registry implements the Confluent API.


Schema Registry provides a REST API for schema operations.

Terminal window
curl -X POST \
-H "Content-Type: application/vnd.schemaregistry.v1+json" \
--data '{"schema": "{\"type\":\"record\",\"name\":\"User\",\"fields\":[{\"name\":\"id\",\"type\":\"long\"},{\"name\":\"name\",\"type\":\"string\"}]}"}' \
http://schema-registry:8081/subjects/users-value/versions

Response:

{"id": 1}
Terminal window
curl http://schema-registry:8081/subjects/users-value/versions/latest
Terminal window
curl -X POST \
-H "Content-Type: application/vnd.schemaregistry.v1+json" \
--data '{"schema": "{...}"}' \
http://schema-registry:8081/compatibility/subjects/users-value/versions/latest
EndpointMethodDescription
/subjectsGETList all subjects
/subjects/{subject}/versionsGETList versions for subject
/subjects/{subject}/versionsPOSTRegister new schema
/subjects/{subject}/versions/{version}GETGet specific version
/schemas/ids/{id}GETGet schema by ID in the active context
/configGET/PUTGlobal compatibility config
/config/{subject}GET/PUTSubject-level compatibility
/modeGET/PUTRead/write or import mode
/contextsGETList isolated registry contexts where supported

Schemas can depend on other registered schemas. A reference includes a name, subject, and version:

{
"schemaType": "PROTOBUF",
"schema": "syntax = \"proto3\"; import \"money.proto\"; message Order { Money total = 1; }",
"references": [
{"name": "money.proto", "subject": "money-proto", "version": 1}
]
}

Register referenced schemas before their dependants. Check reverse references before deleting a version. Implementations that support normalization accept normalize=true on registration and lookup requests so semantically equivalent schema text can be treated consistently. Normalization does not make an incompatible schema change compatible.

Modern Confluent-compatible registries may also expose:

ConceptPurpose
ContextsIsolate subjects, IDs, compatibility settings, and modes for teams or environments
READWRITE / READONLY modesControl whether registrations are accepted globally or per subject
IMPORT modePreserve schema IDs and versions during a migration
Metadata and rule setsAttach ownership, classification, validation, migration, or encoding rules to a schema version

Support varies by implementation and client. In particular, the registry stores data-contract rules, but a compatible serializer or application must execute them.


High-availability behavior is implementation-specific. Do not assume that every registry elects a single writable leader.

Stateless Schema Registry instances with shared durable storage AxonOps Schema Registry instances are stateless. All instances can handle reads and writes against the same PostgreSQL, MySQL, or Cassandra backend, with no registry leader election or session affinity. Confluent Schema Registry instead coordinates instances around its Kafka-backed store. Follow the deployment model for the implementation you run.

AspectRecommendation
InstancesRun at least two registry instances across failure domains
Load balancingUse readiness checks; avoid affinity unless an implementation requires it
StorageMake the registry store highly available and back it up consistently
ClientsConfigure multiple registry URLs where the client supports them, with bounded retries and timeouts
CachingExpect clients to use cached schemas during short outages, but do not treat caches as a backup