3

I got some issues with Camel and Activemq on a OSGI environment (Karaf). I would like that messages in the queue will be redelivered if it has failed! But i want to put a delay before retrying.

I found the class org.apache.activemq.RedeliveryPolicy. I configured a bean in my blueprint xml with the different properties as bellow:

<bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
    <property name="initialRedeliveryDelay" value="2000" />
    <property name="redeliveryDelay" value="15000" />
    <property name="useExponentialBackOff" value="true" />
    <property name="backOffMultiplier" value="5" />
    <property name="maximumRedeliveryDelay" value="120000" />
    <property name="maximumRedeliveries" value="20" />
    <property name="queue" value="*" />
</bean>

When i test this configuration, in case of an error the queue retry as many times it is configured in "maximumRedeliveries" property. But there is no delay between redelivery. In fact initialRedelivery works, but just for the first retry. I have searched in different sites and i'm not the only one who got these issue.

(Ps: I put my redeleveryPolicy Bean in my org.apache.activemq.ActiveMQConnectionFactory )

Thanks for your answers

(I apologize for my english Grammar)

j1704
  • 53
  • 5

2 Answers2

1

If an endpoint is down, Camel and ActiveMQ are only trying to redeliver the first message in the queue. When maximumRedeliveries is reached, by default the message will be placed in a dead letter queue (DLQ) and Camel/ActiveMQ will move on to the next message in the queue. Once an endpoint becomes available, all of the messages backed up in the queue will be delivered as fast as Camel and ActiveMQ can and the redelivery policy is not applied (as all but the first message in the queue are being delivered for the first time, not redelivered).

Joe Hunt
  • 161
  • 2
  • 5
0

The redliveryDelay value is a state tracking value and will not result in the behaviour you expect. You should configure the initial delay and the max delay and allow the other options to control the step sizes of the redelivery back off.

Tim Bish
  • 17,475
  • 4
  • 32
  • 42
  • apache camel Java DSL only has `redeliveryDelay()`, no `initialRecoveryDelay()`. Very confusing. The API says it will set initial delay and I guess it will be used in backoff multiplication right? – WesternGun Nov 07 '22 at 13:53