This has been asked a few times already:
- look at consumer cache, If you want strict ordering in the presence of redelivery, you must disable client cache. Messages are sent ahead to the client to maximize throughput avoiding network latency. In case of failure the messages that were on the cache will be sent back to the queue, what could apparently cause ordering issues as the whole buffer needs to be redelivered.
You need to choose a tradeof between throughput and strict ordering.
Hmmm. Messages shouldn't be delivered out of order even in the case of redelivery.
Redelivery should work as follows:
1) The server consumer is stopped.
2) Delivered but not acked messages are returned to the queue
3) Any messages in the client buffer are cancelled to the queue
4) The server consumer is restarted
(Take a look at the code in rollback to see this)
This should mean the order is preserved, irrespective of consumer buffering.
Of course, this only applies in the case of a single consumer on a queue. If you have more than once consumer on a queue all bets are off since the order in which messages are consumed is determined by the user, so is indeterminate.
I assumed he was using multiple consumers (which is probably the case).
If that's not the case, @Leo Franca: can you provide a working example? Take a look if that's the case first please.
If he's using multiple consumers, setting consumer-window-size to 0 won't help things.
At the end of the day with multiple consumers we can't make any guarantees about ordering on redelivery since it's not under our control.
E.g. if there are messages A, B, C, D, E in the queue
Consumer C1 consumes messages A, B
Consumer C2 consumes messages C, D
Consumer C1 consumers message E
Consumer C2 rolls back C, D
So Consumer C1 will receive messages C, D out of order.
There's nothing we can do about that, since it depends on the when the user consumes and rolls back.
sure, I guess this behaviour would be probably expected from most users...
What I have seen users complaining is messages that they didn't consume being redelivered out of order.
That would be fixed with Message Group anyway.
Also: @Leo: Look at Message group.
Hi guys, thanks for the response. I m using 1 consumer and 1 producer only. If you want I can paste my code here. Its a very simple producer/consumer.
Yes, please... attach some simple test reproducing the issue.
Also: if you could please try with trunk.