<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:tx="http://www.springframework.org/schema/tx";
       xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-2.0.xsd
    http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
 http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd";>

  <bean id="wmq" class="org.apache.camel.component.jms.JmsComponent">
        <property name="connectionFactory" ref="wmqConnectionFactory"/>
        <property name="transactionManager" ref="transactionManager"/>
        <property name="transacted" value="false"/>
  </bean>
   <bean id="required"
class="org.apache.camel.spring.spi.SpringTransactionPolicy">
        <property name="transactionManager" ref="transactionManager"/>
        <property name="propagationBehaviorName"
value="PROPAGATION_REQUIRED"/>
   </bean>
    <bean id="wmqConnectionFactory"
class="com.ibm.mq.jms.MQXAConnectionFactory">
        <... connection properties...>
    </bean>

    <tx:annotation-driven transaction-manager="transactionManager" />
    <bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager"/>

  <bean id="mqRemoteSender" class="... custom class that can send mq
messages via com.ibm.mq.MQQueue">
        <... sending properties ...>
   </bean>

    <... entity beans:
org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager,
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean,
org.springframework.orm.jpa.JpaTemplate etc...>

   <bean id="logger" class="... custom logger class..."/>

    <camelContext trace="true"
xmlns="http://camel.apache.org/schema/spring";>
        <route>
            <from uri="wmq:queue:INNER_QUEUE"/>
            <transacted ref="required"/>
            <doTry>
                <...CAMEL processes where I parse xml-message and save its
properties to DB ...>
                <... Process where I create response xml-message ...>
                <bean ref="logger" method="luckyMessage"/>
                <to uri="bean:mqRemoteSender?method=remoteRoute"/>
             <doCatch>
             
<exception>org.springframework.dao.DataAccessException</exception>
              <handled>
                     <constant>false</constant>
              </handled>
                 <bean ref="logger" method="saveDBErrorMessage"/>
                 <...Error message creation process...>
                 <to uri="bean:mqRemoteSender?method=remoteRoute"/>
              </doCatch>
              <doCatch>
                <exception>java.lang.Exception</exception>
                <handled>
                    <constant>false</constant>
                 </handled>
                 <bean ref="logger" method="commonErrorMessage"/>
                 <...Error message creation process...>
                 <to uri="bean:mqRemoteSender?method=remoteRoute"/>
               </doCatch>
               </doTry>
        </route>
    </camelContext> 
</beans>




--
View this message in context: 
http://camel.465427.n5.nabble.com/Distributed-transaction-in-camel-route-tp5719279p5719586.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to