TIBCO BW XA Transaction Step by Step Tutorial for Distributed Transaction Management

In TIBCO BW Processes, in order to achieve transaction management we use JDBC Transaction Group so that all JDBC activities within that transaction group are committed or rolled back together. This JDBC Transaction works perfectly fine with all JDBC activities having same Database connection but it doesn’t offer transaction management behaviour with multiple database connections or with a combination of JDBC and JMS activities in the same group. To achieve transaction management with multiple DB connections or with a mix of JDBC and JMS connections, TIBCO provides options to use XA Transactions.

In this TIBCO BW XA Transaction step by step tutorial, I will explain how you can use XA transactions to have all activities in a group committed or rolled back together.

What is XA Transaction?

XA (Extended Architecture) is a two-phase commit protocol to achieve data synchronization among multiple data stores. XA is natively supported by many databases (including Oracle) and transaction monitors. It ensures data integrity by coordinating single transactions accessing multiple relational databases. XA guarantees that transactional updates are committed in all of the participating databases, or are fully rolled back out of all of the databases, reverting to the state prior to the start of the transaction.

In TIBCO BusinessWorks processes, we can achieve XA Transaction management by use of Transaction Manager. For XA transaction management, TIBCO provides a product named as TIBCO BusinessWorks XA Transaction Manager which enables you to achieve synchronization of data across distributed systems.

Steps to Implement XA Transaction Management in TIBCO BW

Let’s proceed with a step by step tutorial explaining how to configure and implement TIBCO BW Processes to achieve XA transaction management capabilities using TIBCO XA Transaction Manager.

TIBCO XA Transaction Tutorial Step 1: Install Transaction Manager and Update TRA Files to Include XA Related Jars in Class Path

TIBCO BusinessWorks XA Transaction Manager as a separate product should be installed in your TIBCO Home. Once it has been installed, you will be able to see it under %TIBCO_HOME%/bw/tm/<<version>>

Next you need to add jars under /lib and under /lib/ext to your class path. You can do so by adding the path of these two folders to your designer.tra and bwengine.tra files.

Now we can proceed to the implementation part where we will implement a sample process with two JDBC Updates with difference JDBC connections and a JMS Queue Sender with JMS connection and then all these 3 activities will be made part of one XA transaction group to commit or rollback together.

TIBCO XA Transaction Tutorial Step 2: Configure XA JDBC Connection and JMS Connection

In order to use XA transactions, first we need to add XA TransactionManager Configuration in our project from Transaction Palette as this shared configurations will be used to communicate with XA transaction manager.

Next, we need to create JDBC connection with Connection Type as XA and for XA Data Source Class we need to choose a class depending on our underlying database type. For Oracle, choose oracle.jdbc.xa.client.OracleXADataSource as you can see below:

Since we want to have two separate database connections, we also need to configure another XA JDBC connection pointing to another database schema in similar way.

Next we need to configure a JMS Connection. For JMS Connection, make sure that you check the checkbox for Use XA Connection Factory under JMS Connection Configurations.

TIBCO XA Transaction Tutorial Step 3: Implement a TIBCO BW Process with XA Transaction Group

We will implement a simple process where we will have two JDBC update activities each pointing to a different database and one JMS Queue Sender activity. All these 3 activities will use XA based connections that we created in our previous step.

Transaction group with XA Transaction Type is configured as shown below:

In the process, just to simulate a failure scenario, I put a XPath condition to Generate an Error when the current minute from dateTime function returns an even number. Complete process is as shown below with Two JDBC activities and one JMS activity each using XA based connection.

 

TIBCO XA Transaction Tutorial Step 4: Test TIBCO BW XA Transaction Based Process

To test the implemented scenario, just load the process in designer tester and when we have current time in an even value, process will get aborted based on our Xpath condition and you will see that no commit happens to any database table and also no message gets inserted in JMS Queue as all activities are controlled by XA Transaction Manager.

I hope this tutorial is helpful for you to understand how distributed transaction management works in TIBCO BW using XA Transaction Manager capabilities. Feel free to comment below if you have any queries or comments on this.

Ajmal Abbasi

Ajmal Hussain Abbasi is Integration Consultant By Profession with 13+ years experience in Integration domain mainly with TIBCO products. He has extensive practical knowledge of TIBCO Business Works, TIBCO Cloud, TIBCO Flogo, TIBCO Mashery, TIBCO Spotfire, EMS and TIBCO ActiveSpaces. He has worked on a number of highly critical integration projects in various sectors by using his skills in TIBCO Flogo, TIBCO API Management (Mashery), TCI, Tibco Designer, TIBCO Business Studio, Adapters, TIBCO EMS, RV, Administrator, TIBCO BE, TIBCO ActiveSpaces etc. Ajmal Abbasi has experience with MuleSoft ESB as well. Ajmal Abbasi is also experienced in the area of API Management particularly with WSO2 API management platforms. Ajmal Abbasi is also experienced in developing solutions using Core Java and J2EE Technologies. You can contact Ajmal Abbasi for Consultancy, Technical Assistance and Technical Discussions.

More Posts - Website - Facebook - LinkedIn - YouTube

One thought on “TIBCO BW XA Transaction Step by Step Tutorial for Distributed Transaction Management

Leave a Reply

Your email address will not be published. Required fields are marked *