mattisonchao commented on a change in pull request #13745:
URL: https://github.com/apache/pulsar/pull/13745#discussion_r784479738
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -1137,26 +1137,29 @@ private void resumeAsyncResponse(AsyncResponse
asyncResponse, Set<String> subscr
}
private void internalGetSubscriptionsForNonPartitionedTopic(AsyncResponse
asyncResponse, boolean authoritative) {
- try {
- validateTopicOwnership(topicName, authoritative);
- validateTopicOperation(topicName,
TopicOperation.GET_SUBSCRIPTIONS);
-
- Topic topic = getTopicReference(topicName);
- final List<String> subscriptions = Lists.newArrayList();
- topic.getSubscriptions().forEach((subName, sub) ->
subscriptions.add(subName));
- asyncResponse.resume(subscriptions);
- } catch (WebApplicationException wae) {
- if (log.isDebugEnabled()) {
- log.debug("[{}] Failed to get subscriptions for
non-partitioned topic {},"
- + " redirecting to other brokers.",
- clientAppId(), topicName, wae);
- }
- resumeAsyncResponseExceptionally(asyncResponse, wae);
- return;
- } catch (Exception e) {
- log.error("[{}] Failed to get list of subscriptions for {}",
clientAppId(), topicName, e);
- resumeAsyncResponseExceptionally(asyncResponse, e);
- }
+ validateTopicOwnershipAsync(topicName, authoritative)
+ .thenCompose(__ -> {
+ validateTopicOperation(topicName,
TopicOperation.GET_SUBSCRIPTIONS);
+ return getTopicReferenceAsync(topicName);
+ })
+ .thenAccept(topic -> {
+ final List<String> subscriptions = new
ArrayList<>(topic.getSubscriptions().keys());
+ asyncResponse.resume(subscriptions);
+ }).exceptionally(ex -> {
+ Throwable cause = ex.getCause();
+ if (cause instanceof WebApplicationException) {
+ if (log.isDebugEnabled() && ((WebApplicationException)
cause).getResponse().getStatus()
Review comment:
Fixed, PTAL : )
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]