[jboss-dev-forums] [JBoss Transactions Development] - Disable XA-Transaction in JMS-Datasource using OpenMQ

Jürgen Kunz do-not-reply at jboss.com
Tue Dec 6 10:24:05 EST 2011


Jürgen Kunz [http://community.jboss.org/people/gengar9] created the discussion

"Disable XA-Transaction in JMS-Datasource using OpenMQ"

To view the discussion, visit: http://community.jboss.org/message/640084#640084

--------------------------------------------------------------
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.
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/640084#640084]

Start a new discussion in JBoss Transactions Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2041]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20111206/30260324/attachment.html 


More information about the jboss-dev-forums mailing list