TIBCO Critical Section Group Step by Step Tutorial

In order to achieve synchronization and to ensure that only one process instance is able to run a set of activities grouped together at a particular time; Critical Section Group type is used in TIBCO processes. In this TIBCO Critical Section Group step by step tutorial, I will explain and demonstrate how we can use Critical Section groups to make sure that certain action can be taken only by one process instance at a time.

Example Business Scenario:

A TIBCO BW process updates account balance of account holders by deducting 10 out of the available balance every time It runs. In order to make sure that there is no mismatch or anomaly in the balance of the account holder; we want to make sure that only one process instance at a time can run through the JDBC Update activity in the process.

We are going to achieve the above stated goal by using Critical Section group. Please note that this is just a raw example in order to demonstrate critical section usage and may not necessarily fit in a real time practical scenario.

Let’s now proceed step by step with TIBCO BW Critical Section group tutorial.

 

Step 1: Configure JDBC Connection and Prepare sample data in database table

In this preliminary step; we are going to first add JDBC Connection resource in our project and configure it so that we are able to connect to the database. I am using Oracle database for this tutorial.

From JDBC Palette, drag JDBC Connection resource in the project and configure it as per your database settings (by specifying username, password, Schema name etc). JDBC Connection configuration in my case is shown in below screenshot:

critical section group tutorial jdbc connection

Using Test Connection button, make sure that you are able to connect to the database.

In the database, create a table TBL_ACCOUNT and populate it with some sample data as shown below:

database sample records

Step 2:  Create Process with Critical Section Group

Create a new process and add JDBC Update activity in the process. In the configuration of this JDBC Update activity, write below sql statement which will update balance of account holder ‘ajmal’ by deducting 10.

update tbl_account
set
account_balance=account_balance-10
where account_beneficiary=’Ajmal’

Configuration of JDBC Update is shown in below screenshot:

critical section jdbc update configuration

Just in order to simulate how process instances will wait for previous instance to complete, add a Sleep activity just after JDBC Update activity and give it 60000 as an input so that It sleeps the process instance for 1 minute:

sleep input mapping

Now using Create a group option from the menu bar, enclose JDBC Update and Sleep activities in a group. In the configuration of the group; choose Critical Section as Group Action and Single Group as Scope. (Multiple Group example will be explained in another tutorial).

Group configuration is shown in below screenshot:

critical section single group screenshot

Now our process is ready with all necessary configurations for different activities involved. Complete process will look like below:

critical section group process example

 

Step 3: Test Critical Section Group Process in designer tester

Load the process in designer tester so that its instance starts running.

first instance

While this instance is running inside critical section and is in Sleep state; create another job (another instance) of the process. As you can see in below screenshot; second instance isn’t executing the critical section as It’s waiting for the first instance to complete its critical section execution.

second instance

 

Once the execution of 1st instance is completed; second instance will also run through the critical section.

This completes Single group critical section tutorial. Hope it will help you to understand the concept. Feel free to comment/contact for any further help. Thanks

 

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

3 thoughts on “TIBCO Critical Section Group Step by Step Tutorial

  1. badri

    Hai.. This is badri… Now i am learining tibco bw… i have one dought in critical section in Multiple Groups…. when we have to take the multiple groups and Why?????…. Can you Exaplain any Example for me about Multiple groups…
    Thank You…

    Reply
    1. Venkatesh

      Multiple gropus are taken when processes are running in more than one process engine to synchronize the state of the process instance , we use a data store to store the state of the process instance.

      Reply
  2. darshan

    Please share similar working example and use case for criitcal section multiple groups using lock object

    Reply

Leave a Reply

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