I answered the first half of your question on your other post here.
You're correct that there is no HornetQ API for creating a pooled connection factory. That is because a pooled-connection-factory is actually a JCA-based JMS connection factory. The pooling is provided by JCA and the JMS bits are provided by HornetQ. Generally speaking, using a JCA-based JMS connection factory has these benefits:
- Superior performance (due to pooling).
- Superior usability in a JTA context (since the JCA code will automatically detect an ongoing JTA transaction and enlist the connection into the transaction)
- Superior configurability (e.g. change pool size via XML or CLI instead of modifying code).
Thanks so much. Just a confirmation, do you mean the JCA-based JMS connection factory is using JNDI method?
Yes. Since there is no HornetQ API to instantiate a JCA-based JMS connection factory you will need to look it up in JNDI.