Problem
Producers change event fields without telling consumers, causing deserialization errors or silent misinterpretation. Without a shared source of truth, schemas live in code and documents that drift.
Also known as: schema registry, contract registry for events
Centralize and version event schemas, enforcing compatibility rules so producers and consumers can evolve independently.
Producers change event fields without telling consumers, causing deserialization errors or silent misinterpretation. Without a shared source of truth, schemas live in code and documents that drift.
A schema registry turns event formats into managed contracts. Every message announces which schema wrote it by a compact id.
Compatibility checking at registration time moves breakage from runtime to the build pipeline.
Choosing a compatibility mode depends on who upgrades first. Backward compatibility means new consumers can read old data, which suits consumers that upgrade before producers or that replay history. Forward compatibility means old consumers can read new data, which suits producers that upgrade first. Full compatibility requires both and is the safest default for shared topics.
Producers serialize with a registered schema and prepend its id. Consumers resolve the id through a cached registry client.
wire format: [magic byte][schema id: 4 bytes][avro payload]
producer: id = registry.register("orders-value", schema)
consumer: schema = cache.get(id) or registry.fetch(id)
rule: BACKWARD (new schema reads old data)
Safe evolution has simple rules. Add optional fields with defaults, never reuse a field name for a different meaning, and use deprecation periods before removal. Treat schema subjects as owned artifacts with reviewers. For JSON events without a binary format, JSON Schema in a registry still gives compatibility checks, though messages are larger.
Low - registry service
Medium - availability and governance
Medium - compatibility modes
Registry outage blocks new producers or cold consumers
Wrong compatibility mode lets a breaking change through
Schema ids differ between environments