complone commented on a change in pull request #10544:
URL: https://github.com/apache/pulsar/pull/10544#discussion_r642739810



##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBase.java
##########
@@ -184,6 +191,50 @@ protected ConsumerBase(PulsarClientImpl client, String 
topic, ConsumerConfigurat
         return internalReceive(timeout, unit);
     }
 
+    @Override
+    public CompletableFuture<Message<T>> receiveAsync(int timeout, TimeUnit 
unit) {
+
+        if (listener != null) {
+            return FutureUtil.failedFuture(new 
PulsarClientException.InvalidConfigurationException(
+                    "Cannot use receive() when a listener has been set"));
+        }
+        try {
+            verifyConsumerState();
+        } catch (PulsarClientException e) {
+            return FutureUtil.failedFuture(e);
+        }
+
+        ScheduledExecutorService messageScheduledFuture = 
Executors.newSingleThreadScheduledExecutor(

Review comment:
       @linlinnn Hi 
   I noticed that user @eolivelli mentioned that we should provide users with 
options for their own configuration. I think we should refer to the 
implementation of pulsar's other timing thread pools and let users set how long 
they need to wait when the elements of the receiving queue are 0.
   
   originally posted by @eolivelli in 
https://github.com/apache/pulsar/issues/10479#issuecomment-831996071_
   
   Relevant patches will be submitted in the next few days, thank you for your 
guidance
   




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to