Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • btm-1.3.2.jar
  • geronimo-jta_1.0.1B_spec-1.0.1.jar
  • geronimo-jms_1.1_spec-1.0.1.jar (only if you are going to use JMS)
  • slf4j-api-1.5.2.jar
  • slf4j-jdk14-1.5.2.jar (or any other one available here)

Step 2: Configure

...

JDBC datasource beans

The first things you will need to configure are the connection poolsJDBC datasources.

Here is a sample bean configuration using Embedded Derby:

Code Block
XML
XML
<bean id="derbyDataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource" init-method="init" destroy-method="close">
	<property name="className" value="org.apache.derby.jdbc.EmbeddedXADataSource" />
	<property name="uniqueName" value="derbydb" />
	<property name="maxPoolSize" value="5" />
	<property name="driverProperties">
		<props>
			<prop key="databaseName">derbydb</prop>
		</props>
	</property>
</bean>
Info
titleAPI-created poolsdatasources

Since the pools datasources are created via the BTM API (ie: not with ResourceLoader) it is up to the API user to manage their lifecycle, mainly calling init() before usage and close() at shutdown.
This is why the lifecycle of the poolstwo init-method and destroy-method attributes are set: to have Spring take care of that lifecycle.

Step 2: Configure JMS connection factory beans

The next things you will need to configure are the JMS connection factories.

Here is a sample bean configuration using ActiveMQ:

Code Block
XML
XML

    <bean id="connectionFactory" class="bitronix.tm.resource.jms.PoolingConnectionFactory" init-method="init" destroy-method="close">
        <property name="className" value="org.apache.activemq.ActiveMQXAConnectionFactory" />
        <property name="uniqueName" value="activemq" />
        <property name="maxPoolSize" value="3" />
        <property name="driverProperties">
            <props>
                <prop key="brokerURL">vm://localhost</prop>
            </props>
        </property>
    </bean>
Info
titleAPI-created connection factories

Since the connection factories are created via the BTM API (ie: not with ResourceLoader) it is up to the API user to manage their lifecycle, mainly calling init() before usage and close() at shutdown.
This is why the two init-method and destroy-method attributes are set: to have Spring take care of that lifecycle.

Step 3: Configure BTM beans

The second next thing you need to do is configure beans for BTM.

...