Hi Claus, Yes, I believe I am using request/reply over JMS.
Is there a way to ask Camel to commit a TX at some point in my route? I just sent a clarification on what I'm actually trying to accomplish: if some endpoint in the middle failed, I would the the error to be propagated back to the original producer, and I was hoping that this can be done. Thank you. On Mon, Aug 24, 2009 at 10:49 PM, Claus Ibsen<[email protected]> wrote: > Hi > > Are you doing request/reply over JMS and want to do that with transactions? > If so that is not possible as messages are not commited to the JMS > queue before the TX is comitted. > > > > On Tue, Aug 25, 2009 at 1:55 AM, Ilya S<[email protected]> wrote: >> Hi All, >> >> I'm using Camel 1.6.1 (cannot use 2.0) , with Spring 2.5.6, and ActiveMQ 5.2. >> >> I'm trying to set up Transaction Manager so that my transactions are >> rolled back on error. >> Here is my camel xml config adopted from the examples: >> ========================================================================= >> >> <context:component-scan base-package="org.apache.camel.example.server"/> >> >> <camel:camelContext id="camel"> >> <camel:package>org.apache.camel.example.server</camel:package> >> <camel:jmxAgent id="agent" createConnector="true"/> >> </camel:camelContext> >> >> <broker:broker useJmx="false" persistent="false" brokerName="localhost"> >> <broker:transportConnectors> >> <broker:transportConnector name="tcp" >> uri="tcp://localhost:61616"/> >> </broker:transportConnectors> >> </broker:broker> >> >> <bean id="jms" class="org.apache.camel.component.jms.JmsComponent"> >> <property name="connectionFactory" ref="jmsConnectionFactory"/> >> <property name="transacted" value="true"/> >> <property name="transactionManager" ref="jmsTransactionManager"/> >> <property name="transactionTimeout" value="50000"></property> >> </bean> >> >> <bean id="redeliveryPolicy" >> class="org.apache.activemq.RedeliveryPolicy"> >> <property name="maximumRedeliveries" value="-1"/> >> </bean> >> >> <bean id="jmsConnectionFactory" >> class="org.apache.activemq.ActiveMQConnectionFactory"> >> <!-- use the vm protocol as the JMS broker is running in the >> same >> jvm as Camel --> >> <property name="brokerURL" value="vm://localhost"/> >> <property name="redeliveryPolicy" ref="redeliveryPolicy"/> >> </bean> >> >> <bean id="jmsTransactionManager" >> class="org.springframework.jms.connection.JmsTransactionManager"> >> <property name="connectionFactory" ref="jmsConnectionFactory" >> /> >> </bean> >> >> <bean id="PROPAGATION_REQUIRED" >> class="org.springframework.transaction.support.TransactionTemplate"> >> <property name="transactionManager" >> ref="jmsTransactionManager"/> >> </bean> >> >> <bean id="transactionErrorHandler" >> class="org.apache.camel.spring.spi.TransactionErrorHandlerBuilder"> >> <property name="transactionTemplate" >> ref="PROPAGATION_REQUIRED"/> >> </bean> >> ==================================================================== >> >> I have 2 routes. >> Route 1 (extends from SpringRouteBuilder) >> >> TransactionTemplate template = >> bean(org.springframework.transaction.support.TransactionTemplate.class, >> "PROPAGATION_REQUIRED"); >> Policy<TransactionTemplate> pp = new >> SpringTransactionPolicy<TransactionTemplate>(template); >> >> from("jms:queue:numbers") >> .policy(pp) >> .to("jms:queue:mybadqueue?transactedInOut=true") >> .to("multiplier"); >> >> >> Route 2: >> from("jms:queue:mybadqueue") >> .process(new Processor() { >> public void process(Exchange arg0) throws Exception { >> throw new Exception("Hello World Exception"); >> } >> >> }) >> .to("multiplier"); >> >> >> With this configuration I never get messages sent to "jms:queue:mybadqueue". >> Could someone point me in the right direction? Please, advise. >> >> Thank you. >> Ilya. >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus >
