(Camel version 2.14.1)
I'm trying to get Camel to retry a msg to JMS (actually, MQ over JMS) using a backoff redelivery policy. Here's what I've got:
errorHandler(defaultErrorHandler()
.maximumRedeliveries(-1)
.useExponentialBackOff()
.backOffMultiplier(2)
.maximumRedeliveryDelay(30000)
.retryAttemptedLogLevel(LoggingLevel.WARN));
from("direct:in")
.log("Sending message to MQ")
.to("mq:MY_QUEUE?requestTimeout=1000");
My understanding of what should happen here is that the initial timeout will be 1000ms. After that camel will wait 2000ms, then 4000ms, etc, until we get to 30000ms.
What's happening is that the message is retried, but at 1000ms every time.
What might I need to change in my code above to get the results that I'm looking for?
TIA
Figured this out.
Here are the available configuration parameters that come into play (there are a lot).
On the error handler:
defaultErrorHandler()
.maximumRedeliveries(-1)
.useExponentialBackOff()
.backOffMultiplier(2)
.maximumRedeliveryDelay(10000)
.redeliveryDelay(500)
On the URI:
requestTimeout=400&
requestTimeoutCheckerInterval=300
There are a few scenarios here that act very differently
If the server is down then the fields from the URI (requestTimeout
and requestTimeoutCheckerInterval
) never come in to play. Using the settings above you should see a retry delays of: 500, 1000, 2000, 4000, 8000, 10000, 10000, 10000...
The requestTimeout value is never increased but the retry delay is. So what you'll see is retry delays at: 900, 1400, 2400, 4400, 8400, 10400, 10400, 10400....
Why? Because it takes 400ms (the requestTimeout
to actually fail, after which the errorHandler timer kicks in).
*MessageListenerContainer
:Could not refresh JMS Connection for destination 'REPLY.A.QUEUE' - retrying using FixedBackOff{interval=5000, currentAttempts=67, maxAttempts=unlimited}
This has nothing to do with retrying a message, it happens in another thread. That FixedBackOff
thing is a red herring.
requestTimeoutCheckerInterval
must always be <= requestTimeout
or else the timeout will seemingly happen later than it's supposed toIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With