0 Replies Latest reply on Dec 6, 2011 10:23 AM by gengar9

    Disable XA-Transaction in JMS-Datasource using OpenMQ

    gengar9

      Hi everyone,

       

      I need a third party JMS-Broker with C/C++ support and therefore I evaluate ActiveMQ and OpenMQ. I can integrate both MessageBrokers into JBoss 6.1.0-Final. Because of our requirements I need to switch off <xa-transaction> if I'm using a transactional connection factory because I have to comit the JMS Session to flush the JMS messages. After that I need to immediatly call a receive to wait for the response over a temporary queue. This works as I expected with ActiveMQ but with OpenMQ it won't work and I get the error:

       

      javax.jms.TransactionInProgressException: [C4069]: Cannot perform commit or rollback on an XASession.

       

      Here ist the configuration in imqjms-jms-ds.xml for OpenMQ. There is no <xa-transcation> within the <tx-connection-factory> config:

       

        <tx-connection-factory>

            <jndi-name>imqjms/QueueConnectionFactory</jndi-name>

            <track-connection-by-tx/>

            <rar-name>imqjms-ra.rar</rar-name>

            <connection-definition>javax.jms.QueueConnectionFactory</connection-definition>

            <ServerUrl>localhost:7676/</ServerUrl>

            <min-pool-size>1</min-pool-size>

            <max-pool-size>200</max-pool-size>

            <blocking-timeout-millis>30000</blocking-timeout-millis>

            <idle-timeout-minutes>3</idle-timeout-minutes>

         </tx-connection-factory>

       

      The same is here for ActiveMQ which works pretty well:

       

         <no-tx-connection-factory>

            <jndi-name>activemq/QueueConnectionFactory</jndi-name>

            <track-connection-by-tx/>

            <rar-name>activemq-ra.rar</rar-name>

            <connection-definition>javax.jms.QueueConnectionFactory</connection-definition>

            <ServerUrl>tcp://localhost:61616</ServerUrl>

            <min-pool-size>1</min-pool-size>

            <max-pool-size>200</max-pool-size>

            <blocking-timeout-millis>30000</blocking-timeout-millis>

            <idle-timeout-minutes>3</idle-timeout-minutes>

         </no-tx-connection-factory>

       

      And here is my code that uses the datasources.

       

      Destination replyDest = session.createTemporaryQueue();

      consumer = session.createConsumer(replyDest);

       

      Message m = session.createTextMessage(message);

      // fill message ....

      m.setJMSReplyTo(replyDest);

       

      producer.send(m);

      session.commit();

       

      Message response = consumer.receive(timeout);

      if (response instanceof TextMessage) {

          result = ((TextMessage)response).getText();

      .....

       

      Offcourse I canconfigure the datasource of the ConnectionFactory with <no-tx-connection-factory> and I don't need to commit the JMS session for sending messages. But I really want to know why it works with OpenMQ and not with ActiveMQ. So, how can I disable xa-transactions with the OpenMQ message provider?

       

      Thanks a lot for every answer.