lhotari edited a comment on issue #10832:
URL: https://github.com/apache/pulsar/issues/10832#issuecomment-856677788


   I believe that the Producer 
[flush](https://pulsar.apache.org/api/client/2.7.0-SNAPSHOT/) and 
[flushAsync](https://pulsar.apache.org/api/client/2.7.0-SNAPSHOT/org/apache/pulsar/client/api/Producer.html#flushAsync--)
 methods exist for the use case that you have described.
   
   When using the async API one must ensure the CompletableFutures returned 
from `sendAsync` are handled for the case of errors since the call to 
`flushAsync` will be successful also in the case that one of the messages fails.
   
   Another challenge is the producer flow control (back pressure). By default 
the future returned from sendAsync will complete with an exception when the 
producer queue is full. It's possible to change this behavior in the producer 
settings in the `ProducerBuilder` with `.blockIfQueueFull(true)`, but this has 
a downside of making sendAsync a blocking operation when the queue is full. For 
some solutions this might be fine. 


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