Atomikos Forum |
|
We are using atomikos transactionManager for xa with oracle database and IBM MQ. We found an issue with the order of commit happening for the transaction involving the database update and sending the message.We observed that sometimes the message is getting sent even before the database update is commited. We are using hibernate 3 as ORM.
Here is our config: <jee:jndi-lookup id="dataSource" jndi-name="${jndi.xa.name}" resource-ref="true" default-ref="jdbcDataSource" /> <bean id="jdbcDataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close"> <property name="uniqueResourceName" value="financial_service" /> <property name="xaDataSourceClassName" value="${database.xadatasourceClassName}" /> <property name="minPoolSize" value="15" /> <property name="maxPoolSize" value="30" /> <property name="xaProperties"> <props> <prop key="URL">${jdbc.first.url}</prop> <prop key="user">${jdbc.first.username}</prop> <prop key="password">${jdbc.first.password}</prop> </props> </property> </bean> <bean name="hibernate-properties" class="java.util.HashMap"> <constructor-arg index="0"> <map> <entry key="hibernate.dialect" value="${hibernate.dialect}" /> <entry key="hibernate.show_sql" value="${hibernate.show_sql}" /> <entry key="hibernate.format_sql" value="${hibernate.format_sql}" /> <entry key="hibernate.hbm2ddl.auto" value="${hibernate.hbm2ddl.auto}" /> <entry key="hibernate.order_updates" value="true" /> <!-- supposed to improve performance in highly concurrent system --> <entry key="org.hibernate.envers.do_not_audit_optimistic_locking_field" value="false" /> <!-- envers --> <entry key="hibernate.current_session_context_class" value="jta" /> <entry key="hibernate.transaction.factory_class" value="com.atomikos.icatch.jta.hibernate3.AtomikosJTATransactionFactory" /> <entry key="hibernate.transaction.manager_lookup_class" value="com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup" /> <entry key="hibernate.connection.release_mode" value="after_transaction" /> <entry key="hibernate.cache.use_second_level_cache" value="true" /> <entry key="hibernate.cache.use_query_cache" value="true" /> <entry key="hibernate.cache.region.factory_class" value="net.sf.ehcache.hibernate.EhCacheRegionFactory" /> <entry key="net.sf.ehcache.configurationResourceName" value="/META-INF/spring/ehcache-hibernate.xml" /> <entry key="hibernate.generate_statistics" value="${hibernate.generate_statistics}" /> </map> </constructor-arg> </bean> <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager" /> <!-- Atomikos wrapper for Connection Factory --> <bean id="atomikosConnectionFactory" class="com.atomikos.jms.AtomikosConnectionFactoryBean" init-method="init" destroy-method="close"> <property name="xaConnectionFactory" ref="connectionFactory" /> <!-- IMPORTANT: the resourceName MUST contain MQSeries_XA_RMI --> <property name="uniqueResourceName" value="FINANCIAL_SERVICE_MQSeries_XA_RMI" /> <property name="maxPoolSize" value="15" /> </bean> <bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiTemplate" ref="jndiTemplate" /> <property name="jndiName" value="cn=${mq.xa.jndiName}" /> </bean> <bean id="eventContainer" class="com.atomikos.jms.extra.MessageDrivenContainer" init-method="start" destroy-method="stop" lazy-init="false"> <property name="atomikosConnectionFactoryBean" ref="atomikosConnectionFactory" /> <property name="transactionTimeout" value="3000" /> <property name="destination" ref="eventDestination" /> <property name="messageSelector" value="xmlmessage='${properties.event.financial.switch}'" /> <property name="messageListener" ref="eventMessageListener" /> <property name="poolSize" value="3" /> <property name="exceptionListener" ref="jmsExceptionListener" /> </bean> Is there any thing we need to configure for controlling the order of commit for the participating xa resource? |