Does Spring JmsTemplate close by default?

I wrote a JMS application that runs on the Glassfish web service (also deployed it to JBoss). I noticed that after processing several messages through MessageListener MDP on the JMS server, the connections end!

Tried this with both Apache ActiveMQ and the Glassfish internal JMS broker (openMQ?)

Is there any way to check why this is happening? If this is the default JmsTemplate behavior, what is my alternative for the proper development of JMS manufacturers and consumers?

Thanks!

+4
source share
2 answers

JMSTemplate spring will close and create all resources (Connections, Consumers, Producers ..) every time it receives or sends a message. This will be a huge performance bottleneck if you are not using federated connections, sessions, consumers .....

Having said that, yes, the JMSTemplate should close your connection every time.

+2
source

Yes, the connection is closing. See execution method code :

JmsUtils.closeSession(sessionToClose); ConnectionFactoryUtils.releaseConnection( conToClose, getConnectionFactory(), startConnection); 
+1
source

All Articles