eolivelli commented on issue #17588:
URL: https://github.com/apache/pulsar/issues/17588#issuecomment-1243711727

   it looks like the problem is due to the fact that in order to find the "non 
persistent" topics we are following a separate procedure than for "persistent" 
topics:
   
   
   ```
   public CompletableFuture<List<String>> 
getListOfPersistentTopics(NamespaceName namespaceName) {
           return 
pulsar.getPulsarResources().getTopicResources().listPersistentTopicsAsync(namespaceName);
       }
   
       public CompletableFuture<List<String>> 
getListOfNonPersistentTopics(NamespaceName namespaceName) {
   
           return 
PulsarWebResource.checkLocalOrGetPeerReplicationCluster(pulsar, namespaceName)
                   .thenCompose(peerClusterData -> {
                       // if peer-cluster-data is present it means namespace is 
owned by that peer-cluster and request
                       // should be redirect to the peer-cluster
                       if (peerClusterData != null) {
                           return 
getNonPersistentTopicsFromPeerCluster(peerClusterData, namespaceName);
                       } else {
                           // Non-persistent topics don't have managed ledgers 
so we have to retrieve them from local
                           // cache.
                           List<String> topics = Lists.newArrayList();
                           synchronized 
(pulsar.getBrokerService().getMultiLayerTopicMap()) {
                               if 
(pulsar.getBrokerService().getMultiLayerTopicMap()
                                       .containsKey(namespaceName.toString())) {
                                   
pulsar.getBrokerService().getMultiLayerTopicMap().get(namespaceName.toString())
                                           .forEach((__, bundle) -> {
                                               bundle.forEach((topicName, 
topic) -> {
                                                   if (topic instanceof 
NonPersistentTopic
                                                           && 
((NonPersistentTopic) topic).isActive()) {
                                                       topics.add(topicName);
                                                   }
                                               });
                                           });
                               }
                           }
   
                           topics.sort(null);
                           return CompletableFuture.completedFuture(topics);
                       }
                   });
       }
   ```


-- 
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]

Reply via email to