activemq/activemq-client/src
Endre Stølsvik 2de859f758 AMQ-8617: RedeliveryPolicy:Exponential Backoff + NonBlockingRedelivery = too long delays
(cherry picked from commit 393a696955)

Scenario on client:

1. Employing RedeliveryPolicy with exponential backoff (keeping maximum
redeliveries at default 6)
2. Enabled non-blocking redelivery
3. Receiving e.g. 100 consecutive poison messages (which eventually
should DLQ after max redeliveries)

This will result in massive redelivery delays due to a logic bug.

The reason is that redeliveryDelay is a field variable kept on the
ActiveMQMessageConsumer, instead of being a property on the message - or
that the redelivery delay was calculated per message based on the
redelivery count.

When consecutive messages rollbacks multiple times, the redeliveryDelay
field is continuously multiplied by the backoff multiplier, resulting in
enormous delays.

Fix: Ditch the field variable, instead calculating the redeliveryDelay
per delivery from the redelivery count. (This happens to be identical to
how it is done in afterRollback() in ActiveMQSession:1004.)

Test is added - which fails with the previous code, and passes with
this. Added a debug log line for the calculated delay.
2022-11-22 08:56:09 +01:00
..
main AMQ-8617: RedeliveryPolicy:Exponential Backoff + NonBlockingRedelivery = too long delays 2022-11-22 08:56:09 +01:00
test [AMQ-7426] Upgrade to log4j2 2022-02-24 15:20:51 +01:00