<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Disable XA-Transaction in JMS-Datasource using OpenMQ
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/gengar9">Jürgen Kunz</a> in <i>JBoss Transactions Development</i> - <a href="http://community.jboss.org/message/640084#640084">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi everyone,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong style="color: #ff0000; font-family: courier new,courier;">javax.jms.TransactionInProgressException: [C4069]: Cannot perform commit or rollback on an XASession.</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Here ist the configuration in imqjms-jms-ds.xml for OpenMQ. There is no <xa-transcation> within the <tx-connection-factory> config:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>  <span style="font-family: courier new,courier;"> <tx-connection-factory></span></p><p><span style="font-family: courier new,courier;">      <jndi-name>imqjms/QueueConnectionFactory</jndi-name></span></p><p><span style="font-family: courier new,courier;">      <track-connection-by-tx/></span></p><p><span style="font-family: courier new,courier;">      <rar-name>imqjms-ra.rar</rar-name></span></p><p><span style="font-family: courier new,courier;">      <connection-definition>javax.jms.QueueConnectionFactory</connection-definition></span></p><p><span style="font-family: courier new,courier;">      <ServerUrl>localhost:7676/</ServerUrl></span></p><p><span style="font-family: courier new,courier;">      <min-pool-size>1</min-pool-size></span></p><p><span style="font-family: courier new,courier;">      <max-pool-size>200</max-pool-size></span></p><p><span style="font-family: courier new,courier;">      <blocking-timeout-millis>30000</blocking-timeout-millis></span></p><p><span style="font-family: courier new,courier;">      <idle-timeout-minutes>3</idle-timeout-minutes></span></p><p><span style="font-family: courier new,courier;">   </tx-connection-factory></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The same is here for ActiveMQ which works pretty well:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">   <no-tx-connection-factory></span></p><p><span style="font-family: courier new,courier;">      <jndi-name>activemq/QueueConnectionFactory</jndi-name></span></p><p><span style="font-family: courier new,courier;">      <track-connection-by-tx/></span></p><p><span style="font-family: courier new,courier;">      <rar-name>activemq-ra.rar</rar-name></span></p><p><span style="font-family: courier new,courier;">      <connection-definition>javax.jms.QueueConnectionFactory</connection-definition></span></p><p><span style="font-family: courier new,courier;">      <ServerUrl>tcp://localhost:61616</ServerUrl></span></p><p><span style="font-family: courier new,courier;">      <min-pool-size>1</min-pool-size></span></p><p><span style="font-family: courier new,courier;">      <max-pool-size>200</max-pool-size></span></p><p><span style="font-family: courier new,courier;">      <blocking-timeout-millis>30000</blocking-timeout-millis></span></p><p><span style="font-family: courier new,courier;">      <idle-timeout-minutes>3</idle-timeout-minutes></span></p><p><span style="font-family: courier new,courier;">   </no-tx-connection-factory></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>And here is my code that uses the datasources.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">Destination replyDest = session.createTemporaryQueue();</span></p><p><span style="font-family: courier new,courier;">consumer = session.createConsumer(replyDest);</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">Message m = session.createTextMessage(message);</span></p><p><span style="font-family: courier new,courier;">// fill message ....</span></p><p><span style="font-family: courier new,courier;">m.setJMSReplyTo(replyDest);</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">producer.send(m);</span></p><p><span style="font-family: courier new,courier;">session.commit();</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-family: courier new,courier;">Message response = consumer.receive(timeout);</span></p><p><span style="font-family: courier new,courier;">if (response instanceof TextMessage) {</span></p><p><span style="font-family: courier new,courier;">    result = ((TextMessage)response).getText();</span></p><p><span style="font-family: courier new,courier;">.....</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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. <span style="color: #ff0000;"><strong>So, how can I disable xa-transactions with the OpenMQ message provider?</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thanks a lot for every answer.</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/640084#640084">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Transactions Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2041">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>