lhotari commented on code in PR #25188:
URL: https://github.com/apache/pulsar/pull/25188#discussion_r2737611832


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/TopicListWatcher.java:
##########
@@ -280,7 +282,33 @@ private void cleanupAtClose(CompletableFuture<Void> 
closeFuture, Throwable excep
     }
 
     public void handleCommandWatchTopicUpdate(CommandWatchTopicUpdate update) {
-        
patternConsumerUpdateQueue.appendTopicsRemovedOp(update.getDeletedTopicsList());
-        
patternConsumerUpdateQueue.appendTopicsAddedOp(update.getNewTopicsList());
+        if (update == null) {
+            return;
+        }
+        
patternConsumerUpdateQueue.appendTopicsChangedOp(update.getNewTopicsList(), 
update.getDeletedTopicsList(),
+                update.hasTopicsHash() ? update.getTopicsHash() : "");
+    }
+
+    /**
+     * Perform a single reconciliation request using the existing watcher id 
and the watcher's last-known topics hash.
+     * This will send a WatchTopicList request including the topics-hash to 
the broker. If the watcher is not connected,
+     * the returned future will be completed exceptionally.
+     */
+    public CompletableFuture<CommandWatchTopicListSuccess> reconcile(String 
localStateTopicsHash) {
+        ClientCnx c = cnx();
+        if (c == null || !isConnected()) {
+            CompletableFuture<CommandWatchTopicListSuccess> f = new 
CompletableFuture<>();
+            f.completeExceptionally(new IllegalStateException("Watcher is not 
connected"));
+            return f;

Review Comment:
   This should be fine since there's a fallback in case the connection is 
disconnected at the moment.



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