Redelivery Policy is ignored by Camel on ActiveMQ
michele-82 Nov 5, 2015 7:07 AMHi,
I'm enabling transaction in JMS Queue consuming route, and trying to configure RedeliveryPolicy in Spring/Camel file as you can see below:
<bean id="myRedeliveryPolicyConfig" class="org.apache.camel.processor.RedeliveryPolicy">
<property name="maximumRedeliveries" value="3"/>
<property name="redeliveryDelay" value="60000"/>
<property name="retryAttemptedLogLevel" value="WARN" />
</bean>
<bean id="exceptionHandler" class="org.apache.camel.spring.spi.TransactionErrorHandlerBuilder">
<property name="redeliveryPolicy" ref="myRedeliveryPolicyConfig" />
</bean>
<camelContext id="ActiveMQContext" xmlns="http://camel.apache.org/schema/spring">
<route id="FileToJMS">
<from uri="file:${uriToFile}" />
<to uri="activemq:queue:incomingTickets" />
</route>
<route errorHandlerRef="exceptionHandler" id="normalize-message-data">
<from uri="activemq:incomingTickets" />
<transacted />
<log message="Received: ${body}" />
<rollback />
<!-- <throwException ref="" /> -->
<to uri="mock:result" />
</route>
</camelContext>
I invoke rollback to check if messages are redelivered to a client.
But redelivery policy configuration is ignored because redeliveries are immediate (Underline log warn)
First attempt
12:37:23,471 | WARN | incomingTickets] | TransactionErrorHandler | 198 - org.apache.camel.camel-core - 2.15.1.redhat-620133 | Transaction rollback (0x64f41c09) redelivered(false) for (MessageId: ID:FGBAL201530-51469-1446720227638-11:4:3:1:1 on ExchangeId: ID-FGBAL201530-51470-1446720230674-5-3) caught: org.apache.camel.RollbackExchangeException: Intended rollback. Exchange[JmsMessage[JmsMessageID: ID:FGBAL201530-51469-1446720227638-11:4:3:1:1]]
12:37:23,471 | WARN | incomingTickets] | EndpointMessageListener | 198 - org.apache.camel.camel-core - 2.15.1.redhat-620133 | Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException - org.apache.camel.RollbackExchangeException: Intended rollback. Exchange[JmsMessage[JmsMessageID: ID:FGBAL201530-51469-1446720227638-11:4:3:1:1]]]
12:37:23,511 | INFO | incomingTickets] | normalize-message-data | 198 - org.apache.camel.camel-core - 2.15.1.redhat-620133 | Received: Azienda 7 by Rest API,example4@example.com
12:37:23,521 | WARN | incomingTickets] | TransactionErrorHandler | 203 - org.apache.camel.camel-spring - 2.15.1.redhat-620133 | Rollback (MessageId: ID:FGBAL201530-51469-1446720227638-11:4:3:1:1 on ExchangeId: ID-FGBAL201530-51470-1446720230674-5-4) due: Intended rollback. Exchange[JmsMessage[JmsMessageID: ID:FGBAL201530-51469-1446720227638-11:4:3:1:1]]
12:37:23,521 | WARN | incomingTickets] | TransactionErrorHandler | 203 - org.apache.camel.camel-spring - 2.15.1.redhat-620133 | Rollback (MessageId: ID:FGBAL201530-51469-1446720227638-11:4:3:1:1 on ExchangeId: ID-FGBAL201530-51470-1446720230674-5-4) due: Intended rollback. Exchange[JmsMessage[JmsMessageID: ID:FGBAL201530-51469-1446720227638-11:4:3:1:1]]
Second attempt
12:37:23,521 | WARN | incomingTickets] | TransactionErrorHandler | 198 - org.apache.camel.camel-core - 2.15.1.redhat-620133 | Transaction rollback (0x64f41c09) redelivered(true) for (MessageId: ID:FGBAL201530-51469-1446720227638-11:4:3:1:1 on ExchangeId: ID-FGBAL201530-51470-1446720230674-5-4) caught: org.apache.camel.RollbackExchangeException: Intended rollback. Exchange[JmsMessage[JmsMessageID: ID:FGBAL201530-51469-1446720227638-11:4:3:1:1]]
12:37:23,521 | WARN | incomingTickets] | EndpointMessageListener | 198 - org.apache.camel.camel-core - 2.15.1.redhat-620133 | Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException - org.apache.camel.RollbackExchangeException: Intended rollback. Exchange[JmsMessage[JmsMessageID: ID:FGBAL201530-51469-1446720227638-11:4:3:1:1]]]
12:37:23,581 | INFO | incomingTickets] | normalize-message-data | 198 - org.apache.camel.camel-core - 2.15.1.redhat-620133 | Received: Azienda 7 by Rest API,example4@example.com
12:37:23,581 | WARN | incomingTickets] | TransactionErrorHandler | 203 - org.apache.camel.camel-spring - 2.15.1.redhat-620133 | Rollback (MessageId: ID:FGBAL201530-51469-1446720227638-11:4:3:1:1 on ExchangeId: ID-FGBAL201530-51470-1446720230674-5-5) due: Intended rollback. Exchange[JmsMessage[JmsMessageID: ID:FGBAL201530-51469-1446720227638-11:4:3:1:1]]
12:37:23,581 | WARN | incomingTickets] | TransactionErrorHandler | 203 - org.apache.camel.camel-spring - 2.15.1.redhat-620133 | Rollback (MessageId: ID:FGBAL201530-51469-1446720227638-11:4:3:1:1 on ExchangeId: ID-FGBAL201530-51470-1446720230674-5-5) due: Intended rollback. Exchange[JmsMessage[JmsMessageID: ID:FGBAL201530-51469-1446720227638-11:4:3:1:1]]
and so on.
What do I do to achieve a redelivery with interval of one minute and max redeliveries 3? I wrong a configuration?
Environment:
JBoss Fuse 6.2 on Java 1.8
Thank you in advance
Regards
Michele