Apache Kafka Streaming (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
What is the Confluent Schema Registry, and how does it enforce schema evolution?
senior LevelSystem Design
In Simple Words: In microservices, producers and consumers communicate via binary formats like Apache Avro or Protobuf. If a producer removes a required field or renames an attribute without warning, downstream consumer applications crash with deserialization errors.
- Schema Registry is a standalone HTTP server that stores and versions schemas.
- When producing, the client validates the payload against Schema Registry, prepends a 5-byte Schema ID to the message payload, and sends the binary bytes.
- Downstream consumers fetch the schema by ID to deserialize the message.
Compatibility Modes:
- BACKWARD (Default): New code can read data written by older producers (can delete fields, add optional fields).
- FORWARD: Older code can read data written by newer producers (can add fields, delete optional fields).
- FULL: Both backward and forward compatible.