NOTE: these instructions have been tested with IBM MQ version 220.127.116.11 for all components (queue manager, extended client, and JMS jars).
If MQ is to participate in JTA/XA transactions then you need the "Extended Transactional Client" module from IBM. This is an additional set of JMS libraries licensed separately from MQ. Contact your IBM representative if you don't have this module.
You need to add the following jars to your classpath:
The first jar file is included in the extended client installation, not in the default MQ installation. Don't forget any, or it will not work!
You need at least the following on the server:
Ask your server administrator to create these for you.
To configure Atomikos with Spring and MQ, you need to do the following:
<bean id="mqXaFactory" class="org.springframework.jndi.JndiObjectFactoryBean"> <!-- set the JNDI name of the xa connection factory as configured on the server --> <property name="jndiName" value="..."/> </bean> <bean id="queue" class="org.springframework.jndi.JndiObjectFactoryBean"> <!-- set the JNDI name of the queue as configured on the server --> <property name="jndiName" value="..."/> </bean> <bean id="atomikosConnectionFactory" class="com.atomikos.jms.AtomikosConnectionFactoryBean" init-method="init" destroy-method="close"> <property name="xaConnectionFactory"><ref bean="mqXaFactory"/></property> <!-- IMPORTANT: the resourceName MUST contain MQSeries_XA_RMI --> <property name="uniqueResourceName" value="My_MQSeries_XA_RMI"/> </bean>
You can also choose to configure the XA connection factory programmatically. In that case, you need to create and configure an instance of
com.ibm.mq.jms.MQXAQueueConnectionFactory(for queues) or
The IBM Extended Client documentation refers to the xa_open string that needs to be defined. In Java and with JMS, this is all done by the connectors so you don't need to worry about this.
The IBM documentation also refers to the xa switch structure. Once again, this is taken care of by the JMS connectors so you don't need to worry. The only thing you need to do is ensure that the resourceName of the connection factory includes the string "MQSeries_XA_RMI" as outlined above.