7.4. 使用 Kafka 消费者客户端的 schema
此流程描述了如何配置以 Java 编写的 Kafka 消费者客户端,以使用 Service Registry 的 schema。
先决条件
- 已安装 Service Registry
- 该 schema 使用 Service Registry 注册
流程
使用 Service Registry 的 URL 配置客户端。例如:
String registryUrl = "https://registry.example.com/apis/registry/v2"; Properties props = new Properties(); props.putIfAbsent(SerdeConfig.REGISTRY_URL, registryUrl);
String registryUrl = "https://registry.example.com/apis/registry/v2"; Properties props = new Properties(); props.putIfAbsent(SerdeConfig.REGISTRY_URL, registryUrl);
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 使用 Service Registry deserializer 配置客户端。例如:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1. Service Registry 提供的 deserializer。
- 2.deserialization 是 Apache Avro JSON 格式。