advanced
Kafka schema registry
Use schema registry and compatibility modes to evolve event contracts without breaking independently deployed producers and consumers.
Schema Registry stores Avro, Protobuf, or JSON schemas with version history and compatibility modes (BACKWARD, FORWARD, FULL). Producers register schemas; consumers deserialize with embedded schema IDs. Enforces contract evolution across independently deployed services.
Trade-off: rigidity prevents breaking changes but requires discipline and CI checks; operational dependency on registry availability.
On interviews: add optional field under BACKWARD compatibility; fail CI on incompatible change.
Common pitfalls: bypassing registry with raw JSON; incompatible enum changes; no subject naming strategy per topic.
Checklist:
- Enforce registry in produce and consume paths.
- Set compatibility mode per subject consciously.
- Run compatibility checks in producer CI.
- Plan registry HA and caching on clients.