schema registry 管理 Kafka 消息的数据模式——定义和强制执行事件数据的结构,安全地启用schema evolution。它对生产者和消费者之间的数据一致性和兼容性很重要。
消息中的数据结构问题
Kafka messages are just bytes → producers and consumers must AGREE on the data structure:
→ without management → producers might change the format, breaking consumers
→ how do consumers know the structure? how do you change it safely?
→ a SCHEMA REGISTRY manages this.
schema registry 的作用
SCHEMA REGISTRY → a central service storing and managing message SCHEMAS:
→ defines the STRUCTURE of message data (fields, types) — e.g. with AVRO, Protobuf, JSON Schema
→ producers/consumers reference schemas (by ID) → consistent serialization/deserialization
→ ENFORCES schemas → validates data conforms; consumers know how to parse messages
→ ensures producers and consumers share a consistent, evolving contract
