title: Spring JmsTemplate and Apache ActiveMQ, why so many connections?
body: <p>I have a web application that runs text processing jobs in the background once a message is received on an ActiveMQ which is listened to by a Spring MessageListener....the problem I"m encountering is that once I process around 30 background jobs, ActiveMQ stops processing any messages, Spring message listener loses its JMS connection, and sometimes I get an error in the ActiveMQ log saying that there are too many open files.</p>
  
  <p>I ran the 'lsof' (list open file) command on Linux against the ActiveMQ process and noticed that for almost each message queued/published/received by JmsTemplate, a new connection is opened. Is this normal?</p>
  
  <p>here's my configuration:</p>
  
  <pre><code>&lt;bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory"&gt;
      &lt;constructor-arg ref="amqConnectionFactory" /&gt;
      &lt;property name="exceptionListener" ref="jmsExceptionListener" /&gt;
      &lt;property name="sessionCacheSize" value="100" /&gt;
  &lt;/bean&gt;
  </code></pre>