jkolash opened a new issue #9344:
URL: https://github.com/apache/pulsar/issues/9344


   **Batch version of acknowledgeAsync will return a completed future before 
individual messages complete**
   ```acknowledgeAsync(Messages<?> messages)``` seems to return a completed 
future before futures of individual messages will complete. This also affects  
the sync version of the call ```acknowledge(Messages<?> messages)```  also 
calls this method and also doesn't seem to be right.
   
   From ConsumerBase.java
   ```java
       @Override
       public CompletableFuture<Void> acknowledgeAsync(Messages<?> messages) {
           try {
               messages.forEach(this::acknowledgeAsync); //Futures that can be 
in a pending state
               return CompletableFuture.completedFuture(null); //empty 
completed Future will be complete even if above futures are incomplete or have 
an ExecutionException.
           } catch (NullPointerException npe) {
               return FutureUtil.failedFuture(new 
PulsarClientException.InvalidMessageException(npe.getMessage()));
           }
       }
   ```
   
   **To Reproduce**
   It should be possible to stall the async acknowledgements of the individual 
messages, or even have them fail and the batched version of acknowledgeAsync 
will return successfully no matter what.
   
   **Expected behavior**
   The future returned by ```acknowledgeAsync(Messages<?> messages)``` should 
only complete succesfully after all individual acknowledgements have been 
completed.
   
   **Workaround**
   It should be possible to write your own batch acknowledgment code in the 
meantime.


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