I am using ActiveMQConnectionFactory to create connection. i am creating only one connection. I am having many threads running under this single connection creating session and producer (each thread would have its own session and producer).
My question is: If i am using only one connection then should I use connection pooling (PooledConnectionFactory) or should stick with ActiveMQConnectionFactory. Can anyone please also explain difference between these two (probably in basic terms as I am still on learning curve in activemq).
The answer is, it depends. If you only ever use one Connection in your app and keep it open for the lifetime of the app then you don't gain much by pooling connections, however the PooledConnectionFactory does also do pooling of Sessions and Producers so you still can gain some by not creating and destroying Sessions and Producers but then again if you don't create and destroy those resources then you don't really need pooling of them either.
A pooled connection stuff will create one Connection and keep it open for some time before idling it out (configurable) so if you app tends to create a connection, use it for a bit and close it down only to create another one a short time later then the pool can be a good choice.
In the end you need to examine you app and see how you use the JMS resources. Also the best way to see if it gains you any performance is to try it out and measure the results compared to not using it.