while working on https://jira.jboss.org/browse/HORNETQ-382, I realized that the BridgeWithPagingTest was bogus:
the client's ackBatchSize was too big: the messages were not acked and so depaging was not ocurring.
Once I lower the ackBatchSize, the test passes without any problem.
However, while I was debugging this I was surprised by the code in ClientConsumerImpl#handleMessage():
if (message.getPriority() != 4) { // We have messages of different priorities so we need to ack them individually since the order // of them in the ServerConsumerImpl delivery list might not be the same as the order they are // consumed in, which means that acking all up to won't work ackIndividually = true; }
Once the consumer receives a *single message with a non-default priority*, it will stop to conform to ackBatchSize to ack messages by batch and starts to ack each message individually!
This sounds buggy to me: the user tweaks its ackBatchSize for its settings. Then the consumer will receive a low priority message and starts to ack individually all messages. I don't think this is a correct and expected behavior.
wdyt?
As the comment says, it's necessary to ack individually when there are different priority messages, since the messages might be in a different order in the delivery list.
That's the reason this code was added.