You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/03/05 11:30:41 UTC
[GitHub] [pulsar] sijie commented on a change in pull request #3756: Multi
version generic schema provider
sijie commented on a change in pull request #3756: Multi version generic schema provider
URL: https://github.com/apache/pulsar/pull/3756#discussion_r262456765
##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/HttpLookupService.java
##########
@@ -155,6 +156,30 @@ public String getServiceUrl() {
return future;
}
+ @Override
+ public CompletableFuture<Optional<SchemaInfo>> getSchema(TopicName topicName, byte[] version) {
+ CompletableFuture<Optional<SchemaInfo>> future = new CompletableFuture<>();
+
+ String schemaName = topicName.getSchemaName();
+ String path = String.format("admin/v2/schemas/%s/schema/%s",
+ schemaName,
+ new String(version, StandardCharsets.UTF_8));
+
+ httpClient.get(path, GetSchemaResponse.class).thenAccept(response -> {
+ future.complete(Optional.of(SchemaInfoUtil.newSchemaInfo(schemaName, response)));
+ }).exceptionally(ex -> {
+ if (ex.getCause() instanceof NotFoundException) {
+ future.complete(Optional.empty());
+ } else {
+ log.warn("Failed to get schema for topic {} version {} : {}",
+ topicName, version, ex.getCause().getClass());
Review comment:
version is `byte[]`. this probably doesn't give enough information for debugging. I would suggest converting to a base64 string.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services