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


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBase.java:
##########
@@ -228,7 +233,9 @@ public CompletableFuture<Message<T>> receiveAsync() {
         } catch (PulsarClientException e) {
             return FutureUtil.failedFuture(e);
         }
-        return internalReceiveAsync();
+        return pauseFuture.thenCompose((v) -> {
+            return internalReceiveAsync();
+        });

Review Comment:
   The solution would need to be optimized. Although using a CompletableFuture 
addresses the functional aspects, it's not optimal at all. For example, in this 
case, `.thenCompose` will create new objects on every call, also when pausing 
is disabled. 



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