问题
In the following route, the maximumRedeliveries clausule from redeliveryPolicy is ignored when we get an exception. We get:
Failed delivery for (MessageId: ID-UW205584-58231-1527668174534-39-248 on ExchangeId: ID-UW205584-58231-1527668174534-39-24). On delivery attempt: 0
Failed delivery for (MessageId: ID-UW205584-58231-1527668174534-39-248 on ExchangeId: ID-UW205584-58231-1527668174534-39-24). On delivery attempt: 1
And then it remains in a infinity loop repeating the last retry. Any idea? Thank you very much community!
Our route looks like follows:
<?xml version="1.0" encoding="ASCII"?>
<routes xmlns="http://camel.apache.org/schema/spring">
<route handleFault="true">
<from uri="switchyard://ProcessTaskEx"/>
<log message="ProcessTaskEx - message received: ${body}" loggingLevel="DEBUG" logName="WebServiceQueues" />
<to uri="switchyard://RequestCapacity"/>
<onException>
<exception>java.lang.Exception</exception>
<exception>webservicequeues.utilities.WebServiceQueueException</exception>
<redeliveryPolicy maximumRedeliveries="2" redeliveryDelay="6000" maximumRedeliveryDelay="90000" retriesExhaustedLogLevel="INFO" retryAttemptedLogLevel="INFO"/>
<handled>
<constant>true</constant>
</handled>
<log message="Failed after Retry.Sending ProcessTask Request to Error Queue" loggingLevel="ERROR" logName="WebServiceQueues" />
<to uri="switchyard://ErrorProcessTaskExQueue"/>
</onException>
</route>
</routes>
回答1:
Because you get an infinite loop, it sounds like the message header CamelRedeliveryCounter
gets overwritten every time and therefore it never reaches the maximumRedeliveries
of 2.
Is it possible that the call to the endpoint where the error occurs deletes or resets message headers? Particularly CamelRedeliveryCounter
?
来源:https://stackoverflow.com/questions/50601473/onexception-maximumredeliveries-ignored