I used the Spring JMS cachingconnectionfactory to improve the performance of the my application based on Spring Integration and IBM MQ. I put sessioncachesize as 10 as we have the max of 10 concurrent threads working (ThreadPoolTaskExecutor) on consume/sending messages.
When I looked at the number of connections opened in MQ explorer (open output count for queue), it shows 10 and it stays on for days and never getting closed.
- Is there a way to programatically to detect connections which are potentially stale - say idle for half a day - I checked the resetConnection() but not sure how to get the last used time for the session.
- Does Spring provides any connection time out parameter for cacheconnection factory? or How to release these idle connections?
Also, the heartbeat/keepalive mechanism will not work for us as we want to physical close the cached connections based on last used time.
CachingConnectionFactory
is a subclass ofSingleConnectionFactory
. There is only one connection from each factory; the sessions are cached within that connection. – Gary Russell