Unlike the non-XA JMS ConnectionFactory class, XAConnectionFactory is not meant to be directly used by an application programmer. It is supposed to be used internally by XA-compliant connection pools. In clear: you should never use XAConnectionFactory in your code.As explained in Using an external connection pool with TransactionsEssentials® you cannot use a non-XA connection pool so TransactionsEssentials comes bundled with a XA-compliant JMS connection pool represented by the class !AtomikosConnectionFactoryBean. Transaction methods like enlistResource and delistResource. You also don't have to care about recovery as this is also handled fully transparently.
Just remember that if you use an AtomikosConnectionFactoryBean all the complexities of XA are transparenlty taken care of.javax.jms.ConnectionFactory to the application programmer. It is easy to setup by using its setter methods but can also be easily built from a Spring BeanFactory. Here is an example of code that creates a AtomikosConnectionFactoryBean with 5 connections in the pool:
XAConnectionFactory xacf = ... //construct vendor-specific xa connectionfactory AtomikosConnectionFactoryBean cf = new AtomikosConnectionFactoryBean(); cf.setUniqueResourceName("oracle"); cf.setXaConnectionFactory ( xacf ); cf.setPoolSize ( 5 );You can then use it like you'd use a normal ConnectionFactory:
Connection c = cf.getConnection(); // ... make use of the connection c.close();
For non-XA transactions, either:
|Important change since release 3.9: XA is now the default session mode. To disable XA, set localTransactionMode=true.|