I've been looking at the new producer api with anticipation, but have not
fired it up yet.
One question I have, is it looks like there's no longer a 'batch' send mode
(and I get that this is all now handled internally, e.g. you send
individual messages, that then get collated and batched up and
Internally it works as you describe, there is only one CountDownLatch per
batch sent, each of the futures is just a wrapper around that.
It is true that if you accumulate thousands of futures in a list that may
be a fair number of objects you are retaining, and there will be some work
involved in
I guess it would make the api less clean, but I can imagine a sendBatch
method, which returns a single Future that gets triggered only when all
messages in the batch were finished. The callback info could then contain
info about the success/exceptions encountered by each sub-group of
messages.