Message-ID: <600036387.42357.1371715781080.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_42356_1093277996.1371715780645" ------=_Part_42356_1093277996.1371715780645 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
BTM XA connection factories can be created - like their JDBC counterpart= s - via some java code or via a BTM-specific tool called the Resource Loade= r. You are free to choose the method you prefer, there is absolutely no dif= ference between them.
|Supported JMS versions|
BTM only = supports the JMS 1.1 API. Only servers supporting it can be used with BTM. = There is currently no way to make BTM work with JMS 1.0.2 API.
BTM comes bundled with a JMS XA connection pool which is very easy to co= nfigure. You basically have to create an instance of bitronix.tm.resource.jms.Pooling= ConnectionFactory set some properties and you're done.
Here is an example of datasource creation that connects to an ActiveMQ J= MS server:
1. The Bitronix
is a javabean that implements
2. You have to specify the JMS server's
nFactory implementation here.
3. Each connection factory must be assigned a unique name= . This is required for distributed crash recovery.
4. This connection factory can contain at least 1 connect= ion. 0 is the default value when unspecified.
5. This connection factory can contain at most 5 connecti= ons.
6. You have to set
true if you want to be able to send or receive messages outside of XA tran=
7,8. When both are set, the pooled connections will be cr= eated using the provided user and password instead of without credentials. = This works like if you called
, password) instead of
9. The driverProperties is a
code> object. You have to add into it a set of property name / property val=
ue of the or to
ActiveMQXAConnectionFactory class. You have to refer=
to the JMS server's documentation to know what can / has to be set. The ActiveMQXAConnectionFactory javadoc contains this list for the=
ActiveMQ case. BTM will perform conversion from
int when necessary.
10,11. You can now use the
like any other
12. Remember to close the
/code> after you're done with it to release the connections.
|No class implemeting XAConnectionFactory ?|
<= p>It might be that the
If your vendor only allows
Like for JDBC, the connection pool will be initialized during the first =
createConnection(). It might be desirable to initializ=
e the pool eagerly, like during application startup rather than having to w=
ait for the first request. This can be done by calling
Now line 7 will initialize the pool and create the 5 connections to the = JMS server instead of line 8.
A connection factory configuration utility is also bundled with BTM. It = is convenient to use it rather than create your connection factory in code.= Refer to the Resource Loader= page for more details.
Here is the equivalent Resource Loader configuration of the previous cod= e example:
You just have to write those properties in a simple text file and tell B=
TM where to load it by setting the
resourceConfigurationFilename property of the Configuration12=
The Resource Loader = will always eager initialize the created connection factories.
Now you also have to know how to get the connection factory created by t= he Resource Loader. There are multiple ways:
bitronix.tm.resource.bind=3Dtrueto your resource l= oader properties file. The connection factories will then be bound to the d= efault JNDI server using their
uniqueNameas their JNDI name.<= /li>
addrTypesomewhere in your JNDI tree. The
bitronix.tm.resourc= e.ResourceObjectFactoryclass will just return the connection factor= y with the specified
uniqueName. This is explained more in-dep= th in the Tomcat12 integration page.<= /li>