XA Connection factories only available from JNDI
The JMS specification does not specify that
XAConnectionFactory implementations should be javabeans. Because of this, it is not always possible to build a
When you have no way to create a
XAConnectionFactory in a javabean way, you can specify the
className argument of
PoolingConnectionFactory to be bitronix.tm.resource.jms.JndiXAConnectionFactory. This class is an implementation of
XAConnectionFactory that will wrap another implementation fetched from JNDI.
providerUrl properties respectively to the JNDI name of the
XAConnectionFactory implementation, the initial context factory and provider URL used to access the JNDI server. The last two parameters can be omitted if the
XAConnectionFactory implementation is available in the default JNDI context (inside an application server for instance).
Here is what your code would look like for creating a SwiftMQ
It is often required to use credentials to be able to connect to a JNDI repository. The bitronix.tm.resource.jms.JndiXAConnectionFactory class fully supports this via its
securityCredentials properties as illustrated bellow:
Other JNDI properties
Some new properties have been added in BTM 2.0.1 to make the
JndiXAConnectionFactory more flexible:
- urlPkgPrefixes Used to set the Context#URL_PKG_PREFIXES.
- narrowJndiObject Used to indicate if PortableRemoteObject.narow() should be applied on the object fetched from JNDI.
- extraJndiProperties Extra JNDI environment properties added the the InitialContext.