Redelivery counter is not getting incremented when LastDeliveredSeqID > BrokerSequenceId
ssue: Redelivery counter is not getting incremented when LastDeliveredSeqID >
Version tested : ActiveMQ 5.14.4 and 5.15.10 versions
I have created the two queues, one for sending requests and other for
receiving its response.
The steps for these queues are given below.
1. SenderA (Machine A) sends Msg on RequestQueue TO ReceiverB (Machine B)
(Redelivery count is 0, Ack Mode:INDIVIDUAL_ACKNOWLEDGE).
2. SenderB sends ResponseMsg on Response queue (Machine B) TO ReceiverA
(Machine A) (Async Msg Listener, Ack Mode:CLIENT_ACKNOWLEDGE)
3. SenderB is waiting for the consumed advisory for ResponseMsg. Request Msg
is not yet acknowledged.
4. ReceiverA acknowledges the ResponseMsg. ResponseMsg consumed advisory is
received by SenderB
5. Machine B disconnects from the embedded broker hosted on Machine A
6. On Machine B reconnection, Broker sends Msg on RequestQueue again ->
ReceiverB (Issue: Redelivery count is 0 instead of 1)
1. The Queue.java has removeSubscription() function which increments the
redelivery counter by comparing lastDeliveredSequenceId and
2. The step4 incremented the LastDeliveredSeqID for message consumed
3. The transport connection updates the lastDeliveredSequenceId for each
consumer by calling
4. The condition “ref.getMessageId().getBrokerSequenceId() ==
lastDeliveredSequenceId” in removeSubscription() doesn’t set
markAsRedelivered to true.
I understand your fix to be a switch from "is the message I'm sending the
same as the most recent one I've already sent" to "is the message I'm
sending the same as or earlier than the most recent one I've already sent."
If I'm understanding that correctly, then I agree with your analysis and