Hi Ashwin, I didn't sent my entire spring configuration, but my ActiveMQComponent was already linked to the transactionManager :
---------------------------------------------------- <bean id="activemqPersistent" class="org.apache.activemq.camel.component.ActiveMQComponent" lazy-init="true"> <property name="connectionFactory" ref="amqPoolConnectionFactory"/> <property name="transactionManager" ref="amqTransactionManager"/> <property name="transacted" value="true"/> <property name="brokerURL" value="${bo.activemq.brokerurl}" /> <property name="acknowledgementModeName" value="CLIENT_ACKNOWLEDGE"/> <property name="maxConcurrentConsumers" value="10" /> <property name="receiveTimeout" value="3000"/> <property name="maxMessagesPerTask" value="1"/> <property name="deliveryPersistent" value="true"/> <property name="usePooledConnection" value="true"/> <property name="testConnectionOnStartup" value="true"/> </bean> ---------------------------------------------------- However, I tried using two different activeMQComponent, and that seemed to solve my problem : I no longer loose messages. The transaction does not seem to work well either : I now have duplicate messages. Regards, -- Céline On Mon, May 9, 2011 at 10:43 PM, Ashwin Karpe <aka...@fusesource.com> wrote: > Hi, > > Sorry about the confusion... You do not need the second connection factory > "activemq2". This is an error on my part. > > The key difference in your setup vs mine is that there is a > "transactionManager" property set in my ActiveMQ component and the > "transacted" property is set to true . This wires in the transactional > capability to the ActiveMQ component. > > Please see the corrected XML below. > > Cheers, > > Ashwin... > > > > ======================================= > ---------------------------------------------------- > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:camel="http://camel.apache.org/schema/spring" > xsi:schemaLocation=" > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd"> > > <camelContext> > <route> > <from ref="activemq:queue:foo" /> > <transacted ref="required"/> > <to ref="activemq:topic:bar" /> > </route> > </camelContext> > > <bean id="jmsConnectionFactory" > class="org.apache.activemq.ActiveMQConnectionFactory"> > <property name="brokerURL" > value="vm://localhost?broker.persistent=false&broker.useJmx=false"/> > </bean> > > <bean id="jmsTransactionManager" > class="org.springframework.jms.connection.JmsTransactionManager"> > <property name="connectionFactory" ref="jmsConnectionFactory"/> > </bean> > > <bean id="activemq" > class="org.apache.activemq.camel.component.ActiveMQComponent"> > <property name="connectionFactory" ref="jmsConnectionFactory"/> > <property name="transacted" value="true"/> > <property name="transactionManager" ref="jmsTransactionManager"/> > </bean> > > <bean id="required" > class="org.apache.camel.spring.spi.SpringTransactionPolicy"> > <property name="transactionManager" ref="amqTransactionManager" /> > <property name="propagationBehaviorName" > value="PROPAGATION_MANDATORY" /> > </bean> > > </beans> >