My description was a little bit simplified, but I think I get the idea. The messages captured by a queue are meant to be send to (possibly) many different customers, so each one message – when consumed is (almost) instantly put in a bucked destined for a specific customer and this is where queue consumer ends its job, leaving ACK the message for someone else in the future. Using `prefetchCount` we can fine tune the processing pace.
Simultaneously, a separate background thread checks the buckets and decides if this is the right time to flush the messages for each bucked separately. It is then possible for messages 1..10 and 50..100 fire first, while 21..49 and 101..200 wait a little bit longer while new messages keep coming.
This is when it ACKs becomes tricky. I would love to use channel.BasicAck with `multiple=true` but it works only if all the messages within a range are ready to go. I will probably implement something like a "smartAck", so the ACKing function will see through all the delivert tags trying to find a way through `multiple=true` and falls back to individual ACKs when needed.
I think it would be great if instead of `multiple=true` we could just pass the collection of delivery tags to be ACKed and the driver would find its way to optimize the process. Not complaining though, the RMQ server and client libraries are nothing but a great experience for us since 2015, and we use NodeJS, Python, JDK and most recently dotnet/F# (since Core 3.0) clients, all with almost no issues.
Thanks,
Witold Szczerba