title: Spring JMS: Why CachingConnectionFactory is created always with started=false?
body: <p>I have a sample app demo working with:</p>
  
  <ul>
  <li>Spring Framework <code>4.2.5</code></li>
  <li>ActiveMQ <code>5.13.3</code></li>
  </ul>
  
  <p>I have the following:</p>
  
  <pre><code>@Bean(name="connectionFactory")
  public CachingConnectionFactory cachingConnectionFactory(ActiveMQConnectionFactory selectedActiveMQConnectionFactory) throws JMSException{
      CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory();
      cachingConnectionFactory.setClientId("ManolitoActiveMQ");
      cachingConnectionFactory.setTargetConnectionFactory(selectedActiveMQConnectionFactory);
      cachingConnectionFactory.setSessionCacheSize(10);
      cachingConnectionFactory.createConnection().start();
      return cachingConnectionFactory;
  }
  </code></pre>
  
  <p>When I use the <code>cachingConnectionFactory.createConnection().start();</code> line
  I can see that when my app starts it shows:</p>
  
  <blockquote>
    <p>3370 [main] INFO  o.s.j.c.CachingConnectionFactory - Established shared JMS Connection:
    ActiveMQConnection {id=ID:sometext,clientId=ManolitoActiveMQ,started=false}</p>
  </blockquote>
  
  <p>Has sense expect that message when the app starts and read <code>Established shared JMS Connection</code> but why shows <code>started=false</code>? I think should be true.</p>
  
  <p>If I comment <code>cachingConnectionFactory.createConnection().start();</code> and start the app, the message shown above does not appear, ok, it is expected. But later through <code>JMX</code> when I start to send messages, I can see again </p>
  
  <blockquote>
    <p>3370 [main] INFO  o.s.j.c.CachingConnectionFactory - Established shared JMS Connection:
    ActiveMQConnection {id=ID:sometext,clientId=ManolitoActiveMQ,started=false}</p>
  </blockquote>
  
  <p>Ok it is expected, but again <code>started=false</code> appears</p>
  
  <p>It is confuse in some point because the <code>cachingConnectionFactory.createConnection().start()</code> line ends with <code>start()</code> for the <em>Connection</em></p>
  
  <ol>
  <li>Therefore why practically always appears <code>started=false</code>?</li>
  <li>When or how that <code>started</code> attribute would appear with <code>true</code>?</li>
  </ol>