Hi I'm still struging with the transaction hadnling in Camel. No matter what I try and can't seem to get any different behaviour than a message failing retrying the default amount of times and then been forwared onto the activeMQ.DLQ. I've tried most different examples and sugestions from the forums but it I can't seem to change the behaviour. Below is my XML and java code to show the configuration
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd"> <bean id="myProcessor" class="MyProcessor" /> <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring"> <package>com.SpringTest</package> </camelContext> <!-- configuration of the transaction error handler --> <bean id="redeliveryPolicyConfig" class="org.apache.camel.processor.RedeliveryPolicy"> <!-- try up till 5 times --> <property name="maximumRedeliveries" value="50" /> <!-- wait 5 seconds at first redelivery --> <property name="initialRedeliveryDelay" value="5000" /> <!-- increas the wait time for each redelivery --> <property name="useExponentialBackOff" value="true" /> <!-- wait at most 30 seconds between redelivery --> <property name="maximumRedeliveryDelay" value="30000" /> </bean> <bean id="required" class="org.apache.camel.spring.spi.SpringTransactionPolicy"> <constructor-arg> <bean class="org.springframework.transaction.support.TransactionTemplate"> <property name="transactionManager" ref="jmsTransactionManager" /> <property name="propagationBehaviorName" value="PROPAGATION_REQUIRES_NEW" /> </bean> </constructor-arg> </bean> <!-- the standard spring transaction template for required --> <bean id="jmsTransactionTemplate" class="org.springframework.transaction.support.TransactionTemplate"> <property name="transactionManager" ref="jmsTransactionManager" /> </bean> <!-- the transaction error handle we refer to from the route --> <bean id="transactionErrorHandler" class="org.apache.camel.spring.spi.TransactionErrorHandlerBuilder"> <property name="transactionTemplate" ref="jmsTransactionTemplate" /> <!-- here we refer to the configurations of the error handler --> <property name="redeliveryPolicy" ref="redeliveryPolicyConfig" /> </bean> <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="tcp://localhost:61616" /> </bean> <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager"> <property name="connectionFactory" ref="jmsConnectionFactory" /> </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> <bean id="activemq" class="org.apache.camel.component.jms.JmsComponent"> <property name="configuration" ref="jmsConfig" /> </bean> <bean id="noErrorHandler" class="org.apache.camel.builder.NoErrorHandlerBuilder" /> </bean> Here is my java code for the RouteBuilder package configure() errorHandler(loggingErrorHandler()); exception(Exception.class).to("jms:queue:TestQueue.exception"); from("jms:queue:TestQueue") .policy( (SpringTransactionPolicy)ctx.getBean("required")) .process( (Processor)ctx.getBean("myProcessor")); and here is the java code for MyProcessor which just throws and exception public class MyProcessor implements Processor { public void process(Exchange exchange) throws Exception { throw new Exception("Forced Exception"); } } As I say no matter what I try and I can't seem to get a different behaviour I can see by the log file that if I change the errorhandler I don't get the call to the DeadLetter classes but it still appears on there. But I can never get any exception to appear on the exception queue infact the queue is never created. I'm using ActiveMQ 5.1 and the latest SNAPSHOT of Camel. Any help would be greatly appreaciated I've been trying different combinations and looking at the code for this for the last two days with no success. Thanks Mike -- View this message in context: http://www.nabble.com/Camel-Exception-Handling-tp18417527s22882p18417527.html Sent from the Camel - Users mailing list archive at Nabble.com.
