Michael Doberenz wrote:
We have a set of publishers each of which publish messages in order,
and a single durable subscriber. We're not using transactions and
we're set up to use client acknowledgment. If the subscriber is taken
down in between the call of MessageListener.onMessage and
Message.acknowledge, we are getting the retransmission of any
unacknowledged messages, as expected. However, these messages are
received after any newly published messages.  As an example:

A publisher sends messages 1, 2 and 3. The subscriber receives and
acks messages 1 and 2, but goes down in between receiving and acking
message 3. A publisher sends messages 4 and 5. The subscriber
restarts and receives message 4, then 5, then 3.

Is this expected behavior? If so, is there any way to expect these
out of order messages?

Currently, messages are taken off the queue when sent to consumers then requeued again (at the end of the queue) if the client fails to acknowledge them, so yes it is expected in one sense. In the scenario you describe though that behaviour is clearly not desirable. I'm afraid thats a bug in the current design.

Redelivered messages should have the redelivered flag set which can be used to alert applications that the message was delivered, not acknowledged and thus re-delivered. I'm not sure that helps much in your scenario though as you will already have processed 4 & 5 before realising that 3 is redelivered.

Order should really be preserved for redelivered messages as far as is possible, and in the case of a single consumer that would seem always to be possible.

Reply via email to