in example/src/main/java/org/apache/rocketmq/schema/registry/example/UpdateSchemaDemo.java [30:51]
public static void main(String[] args) {
String baseUrl = "http://localhost:8080";
SchemaRegistryClient schemaRegistryClient = SchemaRegistryClientFactory.newClient(baseUrl, null);
String topic = "TopicTest";
UpdateSchemaRequest request = UpdateSchemaRequest.builder()
.schemaIdl("{\"type\":\"record\",\"name\":\"Charge\",\"namespace\":\"org.apache.rocketmq.schema.registry.example.serde\","
+ "\"fields\":[{\"name\":\"item\",\"type\":\"string\"},{\"name\":\"amount\",\"type\":\"double\"}"
+ ",{\"name\":\"currency\",\"type\":\"string\",\"default\":\"CNY\"}]}")
.build();
try {
UpdateSchemaResponse response
= schemaRegistryClient.updateSchema(topic, "Charge", request);
System.out.println("update schema success, schemaId: " + response.getRecordId());
Thread.sleep(5000);
System.out.println("current schema: " + schemaRegistryClient.getSchemaBySubject(topic));
} catch (RestClientException | IOException | InterruptedException e) {
e.printStackTrace();
}
}