title: WebSphere MQ connection pooling with Tomcat
body: <p>Tomcat has a built-in JDBC connection pooling, but unfortunately no built-in JMS connection pooling.</p>
  
  <p>We are migrating a legacy Tomcat web application from WebSphere MQ version 6 to 7. 
  Unfortunately, connection pooling has been removed in WebSphere MQ 7 as described here: <a href="http://www-01.ibm.com/support/docview.wss?uid=swg21665128" rel="nofollow">http://www-01.ibm.com/support/docview.wss?uid=swg21665128</a></p>
  
  <p>Now we are afraid that we will run into troubles if we just use the following code for configuring MQ in Tomcat:</p>
  
  <pre><code>        &lt;Resource name="jms/XXXQCF" auth="Container"
              type="com.ibm.mq.jms.MQQueueConnectionFactory" factory="com.ibm.mq.jms.MQQueueConnectionFactoryFactory"
              description="JMS Queue Connection Factory"
              HOST="xxx.com" PORT="1429" CHAN="XXX" TRAN="1"
              QMGR="XXX" /&gt;
  </code></pre>
  
  <p>The reason for our concerns is that this will not use a pooled JMS provider when using MQ 7. For details, see also <a href="http://activemq.apache.org/jmstemplate-gotchas.html" rel="nofollow">http://activemq.apache.org/jmstemplate-gotchas.html</a>              </p>
  
  <p>Alternative solutions we see are:</p>
  
  <p>1) Use of Atomikos</p>
  
  <p>Atomikos has a com.atomikos.jms.AtomikosConnectionFactoryBean that can be used instead of MQQueueConnectionFactory
  But using an XA transaction manager is a huge overhead when we don't need XA</p>
  
  <p>2) Use Spring's CachingConnectionFactory</p>
  
  <p>looks like a good solution, but unfortunately our legacy application does not use Spring.
  So we assume that using CachingConnectionFactory would mean quite some effort.</p>
  
  <p>3) Use Apache Commons Pool</p>
  
  <p>looks promising too, but implementing it correctly for JMS will require some good JMS knowledge</p>
  
  <p>Our questions:</p>
  
  <ul>
  <li>is there a JMS provider that can be used to wrap MQQueueConnectionFactory and that will pool connections, sessions, producers and consumers?</li>
  <li>did anyone succeed in implementing one of the alternative solutions we outlined above?</li>
  </ul>