7.4. 使用 Kafka 使用者客户端的模式
这个步骤描述了如何将使用 Java 编写的 Kafka 使用者客户端配置为使用 Service Registry 中的模式。
先决条件
- 已安装 Service Registry
- 模式在 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 反序列化器配置客户端。例如:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1.Service Registry 提供的反序列化器。
- 2.反序列化采用 Apache Avro JSON 格式。