Claus, Is there any guidance on how to set up XA correctly? We're having a really rough time getting Websphere MQ and SQL Server connections to work together in an XA fashion.
Thanks, james On Thu, Sep 13, 2012 at 10:17 AM, Claus Ibsen <claus.ib...@gmail.com> wrote: > For that you would need XA when you have 2+ resources participating in > the same transaction. > It can be tricky to setup. You would need to use the JTA transaction > manager from WebSphere etc which supports XA. > > Make sure the MQ connection factory you refer to is the XA one. > > On Thu, Sep 13, 2012 at 2:59 PM, Caa_man <c...@acs-it.ru> wrote: >> Hello! >> >> I`d like to built a camel route with this logic: >> >> - receive message with XML from WebSphere queue (camel "from") >> - begin transaction (distributed transaction via "transacted") >> - parse xml (camel "process") >> - save income message to Oracle DB (camel "process") >> - create reply message (camel "process") >> - send reply message to WebSphere queue (camel "to" with >> uri="bean:mqRemoteSender?method=remoteRoute", where I manually send >> camel-message body to MQQueue object) >> >> i.e. I`d like to do "INSERT" request to DB and send message in single >> transaction. >> >> I use: >> >> 1) JmsComponent: >> <bean id="wmq" class="org.apache.camel.component.jms.JmsComponent"> >> <property name="connectionFactory" ref="wmqConnectionFactory"/> >> <property name="concurrentConsumers" value="5"/> >> <property name="maxConcurrentConsumers" value="5"/> >> <property name="transactionManager" ref="transactionManager"/> >> <property name="transacted" value="true"/> >> </bean> >> <bean id="wmqConnectionFactory" >> class="com.ibm.mq.jms.MQConnectionFactory"> >> <property name="transportType" value="1"/> >> <property name="hostName" value="${HostName}"/> >> <property name="port"> >> <bean id="portValue" class="java.lang.Integer"> >> <constructor-arg value="${PortValue}"/> >> </bean> >> </property> >> <property name="queueManager" value="${ManagerName}"/> >> <property name="channel" value="${ConnectionChannel}"/> >> </bean> >> 2) Transaction policy: >> <bean id="required" >> class="org.apache.camel.spring.spi.SpringTransactionPolicy"> >> <property name="transactionManager" ref="transactionManager"/> >> <property name="propagationBehaviorName" >> value="PROPAGATION_REQUIRED"/> >> </bean> >> 3) Transaction manager: >> <bean id="transactionManager" >> class="org.springframework.transaction.jta.JtaTransactionManager"/> >> 4) Annotation driver: >> <tx:annotation-driven transaction-manager="transactionManager" /> >> 5) Process with DB save requests: >> >> private org.springframework.orm.jpa.JpaTemplate jtaTemplate; >> >> @Transactional(propagation = Propagation.REQUIRED) >> @Override >> public void process(Exchange exchange) throws Exception { >> SomeEntityClass entityObject = new SomeEntityClass(); >> ... >> jtaTemplate.persist(entityObject); >> jtaTemplate.flush(); >> } >> 6) persistence-unit: >> <persistence-unit name="jpaName" transaction-type="JTA"> >> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> >> <jta-data-source>jdbc/applicationConnection</jta-data-source> >> <mapping-file>META-INF/orm.xml</mapping-file> >> <class>SomeEntityClass</class> >> <properties> >> <property name="eclipselink.target-server" >> value="OC4J" /> >> <property name="eclipselink.target-database" >> value="Oracle" /> >> <property name="eclipselink.weaving" value="false" /> >> <property name="eclipselink.logging.level" >> value="FINE" /> >> <property name="eclipselink.cache.shared.default" >> value="false"/> >> <property name="eclipselink.jdbc.batch-writing" >> value="Oracle-JDBC" /> >> <property name="eclipselink.jdbc.fetch-size" value="1000" /> >> </properties> >> </persistence-unit> >> >> But there is no distributed transaction. >> Oracle-db-transaction and wmq-send-transaction are independent from >> jms-receive-transaction. >> Whats wrong? >> >> >> >> -- >> View this message in context: >> http://camel.465427.n5.nabble.com/Distributed-transaction-in-camel-route-tp5719279.html >> Sent from the Camel - Users mailing list archive at Nabble.com. > > > > -- > Claus Ibsen > ----------------- > FuseSource > Email: cib...@fusesource.com > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen