The decoupling problem
Producers and consumers of a topic are deployed separately and evolve at different speeds. Without a shared contract, a producer change can break every downstream reader.
What the registry stores
A schema registry is a service that holds versioned schemas, often in Avro, Protobuf, or JSON Schema. Each schema gets an id. A producer registers its schema, then writes only the small id with each message instead of the full schema.
How reads work
A consumer reads the id from the message, fetches the matching schema from the registry, and uses it to deserialize. This keeps payloads small and the schema authoritative.
Compatibility checks
The registry enforces a compatibility rule when a new version is registered:
- Backward lets new consumers read old data.
- Forward lets old consumers read new data.
- Full requires both.
A change that violates the rule is rejected before it can break consumers.
Key idea
A schema registry stores versioned schemas by id and enforces compatibility, so producers and consumers can evolve without breaking the message contract.