【发布时间】:2020-04-08 20:25:53
【问题描述】:
我正在尝试从架构注册表中检索给定 kafka 主题的架构主题版本。我可以使用client.register(schema-name, schema) 成功发布新版本,但我不确定如何检索这些版本。我在下面尝试使用 curl 请求,但结果立即命中 -1(空)。
CachedSchemaRegistryClient client = new CachedSchemaRegistryClient(schemaRegistryUrl, 20);
// curl -X GET http://schema.registry.url:8888/subjects/{topic}/versions/
String command = "curl -X GET --header 'Accept: application/vnd.schemaregistry.v1+json' 'https://schema.registry.url:8888/api/schema-proxy/subjects/mytopic-value/versions'";
Process process = Runtime.getRuntime().exec(command);
Reader reader = new InputStreamReader(process.getInputStream());
int result;
while ((result = reader.read()) != -1){ // Nothing printed
System.out.println(result);
}
我该如何解决这个 GET 请求,或者更好的是,我应该如何使用架构注册表 client 来检索架构?
【问题讨论】:
标签: java apache-kafka confluent-schema-registry