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


   > What if an async sent message failed, and for example, say, it's the 
N/2-th message, and I retry sent this message, eventually, does the consumer 
still can read those messages in order? Is there any chance to cause messages 
disorder?
   
   I believe that with `.blockIfQueueFull(true)` the chances for ordering 
problems is not a big concern. However there might not be a guarantee that 
message order is preserved if the results of sendAsync aren't checked before 
sending the next message. It's worth checking with tests what your experiences 
are.
   With the default setting of `.blockIfQueueFull(false)` and using 
`sendAsync`, there's a real challenge how to handle the queue full exceptions 
which are used as a flow control method.
   
   > And why we need to ensure after flush()? you mean it flushes all backed 
in-memory messages safely persisted in Pulsar broker? and for those failed 
messages, it won't in the buffered to-be-sent list, so you have to retry for it?
   
   Flush can succeed regardless of any possible previous failures in message 
sending. The only way to ensure that the messages have been sent is to check 
the results. Checking the CompletableFuture instances could happen after 
calling flush().
   
   Perhaps there are better ways to ensure message delivery with batches when 
using transactions with Pulsar. However I haven't tried that myself.


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