I started with a problem, JMS send is synchronzied per connection(In the TIBCO EMS drivers). This extremely limits outbound throughput of JMS per JVM. If you're building a middleware product, this is an extremely important metric and needs to be tuned appropriately.
So you'd think the solution would be simple. Wire up the connection pooling connection factory from Spring? Doesn't exist... that I'm aware of.
ActiveMQ provides this implementation out of the box, but if you're not using ActiveMQ, and you're using Tibco, you're out of luck.
Now, heavyweight containers like weblogic will do this caching and pooling for you. As the industry moves away from this standard, we'll need to come up with a custom solution.
Our solution was to pool JmsTemplates(using apache commons pools) each with their own connections. Ideally you'd just pool connections, but that would require a custom JmsTemplate implementation, as when I injected a proxy object as a pool, it seemed to only wire that object up on the set and only ever use 1.
We decided against creating a growing and shrinking pool, and currently keep it to a static size. But we could implement these interfaces to gain that functionality.