Yes 

So trying to sumarrize the 3 mails ;): 

*- spring config, thanks to its wrapper, overrided some behavior where AMQ
strictly respects createSession parameters - transacted one. *
/
-------------------------------------------------
See below.
-------------------------------------------------
/
*- by default tomee uses xa activemq connections but AMQ needs a transaction
manager integration - ie the connection factory needs a resource adapter *
/
-------------------------------------------------
See below.
-------------------------------------------------
/
*- the error you have is just the usage of a XA component in a transaction
without the transacted parameter set to true *
/
-------------------------------------------------
The error I got initially was due to misconfiguration of JMS
ConnectionFactory in tomee.xml, I needed to use the resource adapter as you
pointed out.
After swicthing to your approach XA was behaving ok but I kept having a WARN
in logs from the Spring Message receiver. That was due to misconfiguration
of the Spring Message Listener with both:
<property name="sessionTransacted" value="true" />
and <property name="transactionManager" ref="transactionManager" />
while the first one should NOT be there.
Your other suggestion to go from: "session =
conn.createSession(false-->true, Session.AUTO_ACKNOWLEDGE);" in the session
used to forward the message to second ActiveMQ system does not seem to
influence the outcome of the test case, meaning that it succeeds in both
cases.. like if JTA overrides it.
-------------------------------------------------
/
*Bitronix seems to enforce some behavior wrapping AMQ - probably allowing to
use not xa impl but AMQ already impl xa so no need of it. *
/
-------------------------------------------------
Bitronix is a JTA manager that relies on the XA driver of the resources it
has to manage:
        
        <bean id="BitronixTransactionManager"
factory-method="getTransactionManager"
class="bitronix.tm.TransactionManagerServices"
                depends-on="btmConfig" destroy-method="shutdown" />
        
        <bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
                <property name="autodetectTransactionManager" value="false"/>
                <property name="transactionManager" 
ref="BitronixTransactionManager" />
                <property name="userTransaction" 
ref="BitronixTransactionManager" />
        </bean>  
        <bean id="myDatasource" 
class="bitronix.tm.resource.jdbc.PoolingDataSource"
init-method="init" destroy-method="close">
                *<property name="className"
value="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" />*
                <property name="uniqueName" value="MyDataSource" />
                <property name="maxPoolSize" value="10" />
                <property name="driverProperties">
                        <props>
                                <prop key="url">${database.mysql.url}</prop>
                                <prop key="user">${database.mysql.user}</prop>
                                <prop 
key="password">${database.mysql.password}</prop>
                        </props>
                </property>
        </bean>
        <bean id="myIncomingConnFactory"
class="bitronix.tm.resource.jms.PoolingConnectionFactory" init-method="init"
destroy-method="close">
        *<property name="className"
value="org.apache.activemq.ActiveMQXAConnectionFactory" />*
        <property name="uniqueName" value="AMQConnectionFactoryIn" />
        <property name="maxPoolSize" value="5" />
        <property name="cacheProducersConsumers" value="false" />
        <property name="allowLocalTransactions" value="false" /> 
        <property name="driverProperties">
            <props>
                <prop key="brokerURL">${activemqIN.url}</prop>
            </props>
        </property>
    </bean>
-------------------------------------------------
/

Thanks again for your help



--
View this message in context: 
http://tomee-openejb.979440.n4.nabble.com/Tomee-MySql-ActiveMQ-XA-Distributed-Transactions-tp4676680p4676759.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Reply via email to