Reputation: 16271
I have a sample app demo working with:
4.2.5
5.13.3
I have the following:
@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;
}
When I use the cachingConnectionFactory.createConnection().start();
line
I can see that when my app starts it shows:
3370 [main] INFO o.s.j.c.CachingConnectionFactory - Established shared JMS Connection: ActiveMQConnection {id=ID:sometext,clientId=ManolitoActiveMQ,started=false}
Has sense expect that message when the app starts and read Established shared JMS Connection
but why shows started=false
? I think should be true.
If I comment cachingConnectionFactory.createConnection().start();
and start the app, the message shown above does not appear, ok, it is expected. But later through JMX
when I start to send messages, I can see again
3370 [main] INFO o.s.j.c.CachingConnectionFactory - Established shared JMS Connection: ActiveMQConnection {id=ID:sometext,clientId=ManolitoActiveMQ,started=false}
Ok it is expected, but again started=false
appears
It is confuse in some point because the cachingConnectionFactory.createConnection().start()
line ends with start()
for the Connection
started=false
?started
attribute would appear with true
?Upvotes: 0
Views: 1598
Reputation: 174494
Notice that the started=false
is in the toString()
of the connection - it has nothing to do with the connection factory; it relates to the connection just created.
logger.info("Established shared JMS Connection: " + this.connection);
The connection itself will be started later if needed.
Upvotes: 2