We currently use a JMSTemplate102 which looks up a connection factory out of Websphere.
Websphere is pooling connections and sessions for us and that is working well.
We have noticed however that this process is creating and throwing away Message Producers for every message, which is causing high load on our EMS server.
I have been looking at introducing the Spring CachingConnectionFactory, which seems to add the the required cache of producers.
However, CachingConnectionFactory inherits from SingleConnectionFactory so I guess we would lose the option of accessing the connection pool if we wrapped our underlying connection factory with the CachingConnectionFactory. It would constantly return the same connection.
The question is, is there a connection factory implementation that will allow us to both access our underlying connection pool and cache message producers?
[Edit.... Having checked some more, the JMSTemplate102.java is creating and throwing away the message producers internally. Is this where the plan falls down, i.e. even if the CachingConnectionFactory is caching them, the template makes no attempt to access that cache? Is the answer to move away from JMSTemplate altogether to a custom send?? Confused :confused:]
Thanks in advance
A JMS Connection is a shareable resource, so the CachingConnectionFactory should be all you need.
If that is the case, what is the purpose of a connection pool of greater than size 1? Why don't all of the default pools simply return a handle to the same connection if they can be shared freely.
Note this is a very latency sensitive and multithreaded application so we would want to avoid locking on that connection object.
Can I also ask with regards to my Edit. The JMSTemplate seems to create a new message producer anyway without requesting it from any potential cache in the connection factory. Would this help with my end goal of reducing the number of message producers?