public CompletableFuture<PartitionedTopicMetadata> getPartitionedTopicMetadata(TopicName topicName) { String format = topicName.isV2() ? "admin/v2/%s/partitions" : "admin/%s/partitions"; return httpClient.get(String.format(format, topicName.getLookupName()), PartitionedTopicMetadata.class); }
String basePath = topicName.isV2() ? BasePathV2 : BasePathV1; return httpClient.get(basePath + topicName.getLookupName(), LookupData.class).thenCompose(lookupData -> {
public CompletableFuture<PartitionedTopicMetadata> getPartitionedTopicMetadata(TopicName topicName) { String format = topicName.isV2() ? "admin/v2/%s/partitions" : "admin/%s/partitions"; return httpClient.get(String.format(format, topicName.getLookupName()), PartitionedTopicMetadata.class); }
@Override public String getBundleRange(String topic) throws PulsarAdminException { TopicName topicName = TopicName.get(topic); String prefix = topicName.isV2() ? "/topic" : "/destination"; WebTarget target = v2lookup.path(prefix).path(topicName.getLookupName()).path("bundle"); try { return request(target).get(String.class); } catch (Exception e) { throw getApiException(e); } }
@Override public String lookupTopic(String topic) throws PulsarAdminException { TopicName topicName = TopicName.get(topic); String prefix = topicName.isV2() ? "/topic" : "/destination"; WebTarget target = v2lookup.path(prefix).path(topicName.getLookupName()); try { return doTopicLookup(target); } catch (Exception e) { throw getApiException(e); } }
String basePath = topicName.isV2() ? BasePathV2 : BasePathV1; return httpClient.get(basePath + topicName.getLookupName(), LookupData.class).thenCompose(lookupData -> {
String lookupPath = topicName.isV2() ? LOOKUP_PATH_V2 : LOOKUP_PATH_V1; redirect = new URI(String.format("%s%s%s?authoritative=%s", redirectUrl, lookupPath, topicName.getLookupName(), newAuthoritative)); } catch (URISyntaxException | NullPointerException e) { log.error("Error in preparing redirect url for {}: {}", topicName, e.getMessage(), e);