Atomikos Forum

JTA transactions not working correctly in worst cases

Hello,
I have the problem with JTA transactions which consist of two datasources: JMS Fiorano and JDBC Oracle. If everything is good, JTA transactions works well, but if I try to simulate VM crash and rollback some work, some JMS messages are lost.

Product configuration:
 - AtomikosEssentials 3.5.9
 - FioranoMQ 9.1.0
 - Oracle 10g
 
Spring configurations:

<bean id="MessageDrivenContainer" name="MessageDrivenContainer"
        class="com.atomikos.jms.extra.MessageDrivenContainer" init-method="start"
        destroy-method="stop">
        <property name="atomikosConnectionFactoryBean" ref="ConnectionFactory" />
        <property name="destination" ref="inboundQueue" />
        <property name="poolSize" value="1" />
        <property name="messageListener" ref="MessageListener" />
    </bean>

<bean id="ConnectionFactory" class="com.atomikos.jms.AtomikosConnectionFactoryBean"
        init-method="init" destroy-method="close">
        <property name="uniqueResourceName">
            <value>fiorano_jms</value>
        </property>
        <property name="xaConnectionFactory">
            <ref bean="xaFactory" />
        </property>
        <property name="poolSize" value="1" />
    </bean>

<bean id="jdbcDataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean"
        init-method="init" destroy-method="close">
        <property name="uniqueResourceName">
            <value>oracle_db</value>
        </property>
        <property name="xaDataSourceClassName">
            <value>oracle.jdbc.xa.client.OracleXADataSource</value>
        </property>
        <property name="xaProperties">
            <props>
                <prop key="URL">jdbc:oracle:thin:@172.16.4.119:1521:xxx</prop>
                <prop key="user">xxx</prop>
                <prop key="password">xxx</prop>
            </props>
        </property>

    </bean>

<bean id="DAO" name="DAO" class="sk.posam.xatest.consumer.DAO">
        <property name="dataSource" ref="jdbcDataSource"></property>
    </bean>

<bean id="MessageListener" class="sk.posam.xatest.consumer.TextOutputMessageListener">
        <property name="dao" ref="DAO"></property>
    </bean>

My listener:

public void onMessage(Message message) {
        if (message instanceof TextMessage) {
            try {
                TextMessage textMsg = (TextMessage) message;
                String text = textMsg.getText();
                System.out.println("    Received message:" + text);
                dao.insertMessage(text);
        
            } catch (JMSException e) {
                throw new RuntimeException(e);
            }

        }
    }

Also my TM config:

com.atomikos.icatch.service=com.atomikos.icatch.standalone.UserTransactionServiceFactory
com.atomikos.icatch.force_shutdown_on_vm_exit= false
com.atomikos.icatch.max_actives = -1
com.atomikos.icatch.console_file_name = tm.out
com.atomikos.icatch.log_base_name = tmlog
com.atomikos.icatch.tm_unique_name = mirkovTM
com.atomikos.icatch.console_log_level = DEBUG


So everything is working fine, but if I am simulating error that I stop VM (inside which this application is running with Atomikos) some messages are lost.

My use case scenario:
I am putting one message to the queue which is received by my listener and then insert that message to the DB.
I am simulating DB error so JTA transaction has to be rolled back and message has to be in the queue. But if I shut down VM, in some cases there is message in the queue, but in some cases there is no message in the queue, what is wrong and not acceptable by XA definiton.

Thank you for your help in advance.
Miroslav Slobodnik Send private email
Friday, September 25, 2009
 
 
Hi,

This could be a heuristic case - if you give the transaction manager a chance to restart and recover then it should be ok. Did you try that?

HTH
Guy Pardon Send private email
Friday, September 25, 2009
 
 
If I restarted the application there is no message received, it is lost.

How long does it take to recover and how do I found out that it was the heuristic case? I see no message about it in logs.

Also, if I debug mesagelistener code of MessageDrivenContainer and if I pause application in onMessage method, there is no message in the queue in the Fiorano console, but I read that the message can be away from queue if there is commit or rollback, not in the middle of transaction execution. So why there is no message?

Thank you for your reply.
Miroslav Slobodnik Send private email
Saturday, September 26, 2009
 
 
Hi,

Not sure about the answer, but I guess this is product support - which can be purchased through the Atomikos website at http://www.atomikos.com/Main/BuyOnline

Thanks
Guy Pardon Send private email
Sunday, September 27, 2009
 
 
Ok. Thank you.
Miroslav Slobodnik Send private email
Monday, September 28, 2009
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics