Hi! Below is a snippet of my camel route/xml. As you can see, I'm trying to
set up some transaction and error handling there. But I've ran into a couple
of strange issues. Are these known? Can anyone here explain them?
1. Even if the exception thrown by myBean is a TechnicalException (ie. not a
FunctionalException), the method on the myOwnErrorHandler bean is invoked.
How can that happen?
2. Even if maximumRedeliveries is set to 0, for the two onException clauses,
as well as in the redeliveryPolicyConfig, the message is redelivered 5 times
(as default) when an exception occurs. Why are my settings of 0 not read?
3. Based on the above, can you spot any obvious errors in my configurations?
Or should I assume the spring interpretation to be flawed?
Here's the important part of my XML:
<camelContext id="myRouting"
xmlns="http://activemq.apache.org/camel/schema/spring">
<route errorHandlerRef="transactionErrorHandler">
<from uri="activemq:queue/myQueue/aQueue" />
<!-- <policy ref="required"/>-->
<choice>
<when>
<xpath>//type = 'myType'</xpath>
<onException>
<exception>org.my.exception.TechnicalException
</exception>
<redeliveryPolicy
maximumRedeliveries="0" />
<handled>
<constant>true</constant>
</handled>
<!-- ANY SPECIFIC HANDLING HERE? -->
</onException>
<onException>
<exception>org.my.exception.FunctionalException
</exception>
<redeliveryPolicy
maximumRedeliveries="0" />
<handled>
<constant>true</constant>
</handled>
<to uri="bean:myOwnErrorHandler" />
</onException>
<unmarshal>
<jaxb prettyPrint="true"
contextPath="org.my.domain.message" />
</unmarshal>
<to uri="bean:myBean" />
</when>
</choice>
</route>
</camelContext>
<bean id="jmsTransactionManager"
class="org.springframework.jms.connection.JmsTransactionManager">
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
<bean id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="${org.my.activemq.url}"/>
</bean>
<bean id="jmsConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="jmsConnectionFactory"/>
<property name="transactionManager" ref="jmsTransactionManager"/>
<property name="transacted" value="true"/>
<property name="concurrentConsumers" value="1"/>
</bean>
<!-- camel policy we refer to in our route -->
<bean id="required"
class="org.apache.camel.spring.spi.SpringTransactionPolicy">
<property name="template" ref="PROPAGATION_REQUIRED"/>
</bean>
<!-- the standard spring transaction template for required -->
<bean id="PROPAGATION_REQUIRED"
class="org.springframework.transaction.support.TransactionTemplate">
<property name="transactionManager" ref="jmsTransactionManager"/>
</bean>
<!-- the transaction error handler we refer to from the route -->
<bean id="transactionErrorHandler"
class="org.apache.camel.spring.spi.TransactionErrorHandlerBuilder">
<property name="transactionTemplate" ref="PROPAGATION_REQUIRED"/>
<!-- here we refer to the configurations of the error handler -->
<property name="delayPolicy" ref="redeliveryPolicyConfig"/>
</bean>
<!-- configuration of the transaction error handler -->
<bean id="redeliveryPolicyConfig"
class="org.apache.camel.processor.RedeliveryPolicy">
<property name="delay" value="5000"/>
<property name="maximumRedeliveries" value="0"/>
</bean>
<!-- ActiveMQ instance -->
<bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
<property name="configuration" ref="jmsConfig"/>
</bean>
<bean id="myOwnErrorHandler" class="org.my.beans.MyErrorHandler"/>
<bean id="myBean" class="org.my.beans.MyBean"/>
--
View this message in context:
http://www.nabble.com/1.5-error-handling-Spring-config-buggy-not-complete--tp20562554s22882p20562554.html
Sent from the Camel - Users mailing list archive at Nabble.com.