Hi,

Looks like you have not wired your  amqTransactionManager correctly to your
connectionFactory and hence the transaction is not properly wired to the JMS
endpoint.

Please check the example 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&amp;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="activemq2"
class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="brokerURL"
value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false"/>
    </bean>
        
   <bean id="required"
class="org.apache.camel.spring.spi.SpringTransactionPolicy"> 
         <property name="transactionManager" ref="amqTransactionManager" /> 
         <property name="propagationBehaviorName"
value="PROPAGATION_MANDATORY" /> 
   </bean>

</beans>

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
CamelOne 2011: http://fusesource.com/camel2011 
---------------------------------------------------------
--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-with-JMS-transaction-tp4381332p4381695.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to