I investigated deeper into the servicemix-jms code and my conlusion is that XA transactions are only managed by the jca:consumer endpoint (using the JCA spring-jms features) or the JCAConsumerProcessor. It seems impossible to use a JMS with XA, indeed I didn't find anywhere the creation of a javax.jms.XASession.
So as I don't want to use JCA (for the moment, because I don't know what the JCA/JMS bridge exactly does), I will implement my own JMS Binding Component supporting XA. gude wrote: > > I'm not very happy with this solution... > By the way, I noticed that the property JTA_TRANSACTION_PROPERTY_NAME was > never set into the JMS binding component code. So how can I get it to > enlist the submission part of my workflow into the same transaction? > (Remember that I'm just doing JMS -> JMS) > > > Mariusz Brylant wrote: >> >> Gude, >> >> My knowledge of SMX is rather limited, but I am using JMS extensively >> with Mule and some commercial ESBs. From what I have read about SMX it >> seems that id does not provide JNDI registry (which seems like a >> sensible conclusion since SMX is not a JEE container), although I might >> be wrong. >> >> However assuming that I am right, even when you enable automatic >> enlisting of the JNDI resources in the transaction context, you still >> need to be able to lookup activeMQ context from the jndi repository >> (your original configuration does not create AMQ connection based on >> JNDI context lookup). >> >> Even if SMX has inbuilt JNDI facility, in case your are running a >> standalone AMQ, it will not "atomagically" enlist its destinations in >> SMX JNDI registry. >> >> Anyway, you have 2 options - either integrate AMQ with a container like >> Jboss (which provides JNDI facility) or simply grab Jboss AS and use >> Jboss MQ or JBoss Messaging (depending on version of Jboss), If you >> choose the first option, AMQ website describes how to deploy into Jboss. >> If you decide to go with the latter, I am happy to help you configuring >> XA aware destinations in Jboss and your SU to use Jboss MQ instead. I'd >> suggest the latter, since it will allow you to avoid a headache >> integrating AMQ into Jboss. >> >> gude wrote: >>> I forgot to precise that I'm using servicemix 4. There's no more conf >>> directory. Do you where I configure the container in SMX 4? >>> >>> >>> Raphaël Delaporte wrote: >>> >>>> Hi, >>>> >>>> Add autoEnlistInTransaction="true" : >>>> >>>> <sm:container id="jbi" >>>> rootDir="./data/smx" >>>> MBeanServer="#jmxServer" >>>> installationDirPath="./hotdeploy" >>>> monitorDeploymentDirectory="false" >>>> monitorInterval="1" >>>> transactionManager="#transactionManager" >>>> createJmxConnector="false" >>>> depends-on="jndi" >>>> autoEnlistInTransaction="true"> >>>> >>>> >>>> in the conf/servicemix.xml. >>>> >>>> Regards, >>>> >>>> Raphaël >>>> >>>> >>>> 2010/2/4 gude<[email protected]> >>>> >>>> >>>>> For the moment I'm testing the use of XA, next I'll use two different >>>>> JMS >>>>> broker (MQseries and OpenJMS), that's why I want XA. >>>>> I don't understand who enlists my JMS XAResource in the transaction, I >>>>> didn't find anywhere the code who does this neither in servicemix-jms, >>>>> nmr >>>>> or spring-framework. >>>>> I don't understand what you mean conerning the registration of XA >>>>> resources >>>>> in the JNDI registry. I thought that only the transaction manager was >>>>> recoverable from the JNDI properties, and the JBI container is in >>>>> charge >>>>> to >>>>> do this. Then I create my XAConnection and XASessions and enlist it >>>>> into >>>>> a >>>>> new created transaction. That's what I did into an other JBI >>>>> container, >>>>> and >>>>> it worked. >>>>> It seems that there's something I didn't get... >>>>> >>>>> >>>>> >>>>> Mariusz Brylant wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> All XA capable resources participating in the XA transaction should >>>>>> be >>>>>> enlisted in (and looked up from) the JNDI registry. Your >>>>>> configuration >>>>>> suggests that you are actually connecting to a standalone AMQ server >>>>>> which does not provide JNDI registry. >>>>>> >>>>>> Would consider running AMQ deployed inside JEE container as a JCA >>>>>> resource. >>>>>> >>>>>> Also would suggest asking yourself a question if you really need an >>>>>> overhead of the XA transactions - both queues seat on the same >>>>>> resources (#connectionFactory), therefore native/local transaction >>>>>> >>>>> seems >>>>> >>>>>> more appropriate. >>>>>> >>>>>> Have a look here " >>>>>> http://www.infoq.com/presentations/native-transactions-java-spring " >>>>>> >>>>> for >>>>> >>>>>> some ideas. >>>>>> >>>>>> Best regards, >>>>>> Mario >>>>>> >>>>>> Mariusz Brylant >>>>>> [email protected] >>>>>> >>>>>> gude wrote: >>>>>> >>>>>>> Hello, >>>>>>> >>>>>>> I would like to receive a message from a JMS queue and send it into >>>>>>> an >>>>>>> other >>>>>>> one inside the same XA transaction. But I have the following trace >>>>>>> in >>>>>>> >>>>> the >>>>> >>>>>>> log, while attempting to get the input message : >>>>>>> >>>>>>> 16:11:45,323 | INFO | tenerContainer-2 | >>>>>>> >>>>> DefaultMessageListenerContainer >>>>> >>>>>>> | >>>>>>> .DefaultMessageListenerContainer 750 | Setup of JMS message >>>>>>> listener >>>>>>> invoker failed for destination 'queue/transactions-in' - trying to >>>>>>> recover. >>>>>>> Cause: Session's XAResource has not been enlisted in a distributed >>>>>>> transaction. >>>>>>> >>>>>>> my xbean.xml looks like : >>>>>>> >>>>>>> <?xml version="1.0" encoding="UTF-8" ?> >>>>>>> >>>>>>> <beans xmlns:jms="http://servicemix.apache.org/jms/1.0" >>>>>>> xmlns:t1="http://examples/transaction1"> >>>>>>> >>>>>>> <jms:consumer service="t1:t1jmsreceiver" >>>>>>> endpoint="t1jmsreceiver" >>>>>>> targetService="t1:t1sendtot2" >>>>>>> targetEndpoint="t1sendtot2" >>>>>>> destinationName="queue/transactions-in" >>>>>>> connectionFactory="#connectionFactory" >>>>>>> marshaler="#consumerMarshaler" >>>>>>> synchronous="true" >>>>>>> transacted="xa" >>>>>>> sessionAcknowledgeMode="2"/> >>>>>>> >>>>>>> <jms:provider service="t1:t1sendtot2" >>>>>>> endpoint="t1sendtot2" >>>>>>> destinationName="queue/transactions-checkpoint" >>>>>>> connectionFactory="#connectionFactory"/> >>>>>>> >>>>>>> <bean id="connectionFactory" >>>>>>> class="org.apache.activemq.ActiveMQXAConnectionFactory"> >>>>>>> <property name="brokerURL" value="tcp://localhost:61616" >>>>>>> /> >>>>>>> </bean> >>>>>>> >>>>>>> <bean id="consumerMarshaler" >>>>>>> class="org.apache.servicemix.jms.endpoints.DefaultConsumerMarshaler"> >>>>>>> <property name="mep" >>>>>>> value="http://www.w3.org/2004/08/wsdl/in-only" >>>>>>> /> >>>>>>> <property name="copyProperties" value="true" /> >>>>>>> </bean> >>>>>>> >>>>>>> </beans> >>>>>>> >>>>>>> What should I do? >>>>>>> >>>>>>> >>>>>> >>>>> -- >>>>> View this message in context: >>>>> http://old.nabble.com/Session%27s-XAResource-has-not-been-enlisted-in-a-distributed-transaction.-tp27452437p27455535.html >>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com. >>>>> >>>>> >>>>> >>>> >>> >>> >> >> > > -- View this message in context: http://old.nabble.com/Session%27s-XAResource-has-not-been-enlisted-in-a-distributed-transaction.-tp27452437p27530904.html Sent from the ServiceMix - User mailing list archive at Nabble.com.
