TIBCO Tutorial: How to do Process Synchronization Using Wait and Notify

By | July 1, 2014

In TIBCO BW, Jobs are executed in separate threads and we often need to synchronize the job threads through communication between the jobs running separately in same engine or in separate engine.

In this step by step tutorial, I will teach you how you can use Wait and Notify activities in TIBCO BW processes for synchronization of processes.

Wait and Notify activities of TIBCO are similar to the concept of semaphores in other programming languages. A process containing a Wait activity waits for another process to execute a corresponding Notify activity.

For this tutorial, we are going to explore the process synchronization feature of TIBCO with an example scenario where one process will use a Wait activity before sending a HTTP response. Other process will be having a notify activity through which a response will be sent to the process having a wait activity.

Let’s proceed step by step to see how Wait and Notify is used for process synchronization in TIBCO:

Step 1: Add Notify Configuration resource in the project

For passing data between executing instances of processes, Notify Configuration resource is used which specifies the schema for passing this data.  Add Notify Configuration from the General Activities Palette. In this example scenario, I have kept it simple by having just a string element variable in the Data tab of this resource as shown below:

notify configuration resource

 

Step 2: Create a process with Wait activity

Let’s create a new process and call it WaitProcess. This process will wait for a notification from another process and It will write data to a file once notification is received.

Notify configuration that we created in Step 1 will be given in the configuration tab of Wait activity as shown below:

tibco wait configuration

In the Write File activity, we are going to write the notification message received along with the time stamp to a file as shown in the screenshot below:

wait and notify write file activity

 

Step 3: Create a process with Notify activity

Our next step is to add another process in which we will be using Notify activity. For this example case, I am sending the notification upon receiving a HTTP Request.

In the Input tab of Notify activity, I am sending a message back to the process where we have a Wait activity as you can see in below screenshot:

tibco notify input tab

 

HTTP Receiver and Send HTTP Response activities in this process have been added only to receive a HTTP request and send some response back to the http request.

Step 4: Test Wait and Notify Based Process Synchronization

Once we have our processes with Wait and Notify activities ready, let’s proceed with testing using designer tester.

Load both processes in the tester and create a job instance for the WaitProcess. As you can see below process goes in a wait state at Wait activity:

tibco tester wait activity

 

Now let’s send a http request to the IP address and Port specified in the HTTP connection being used in the NotifyProcess. As seen below, process has run and It has sent back a notification using Notify activity to the process having a Wait activity:

tibco designer tester notify

 

Now if you look at the WaitProcess in the tester, you will see that Process has now run forward from Wait activity to the end as you can see below:

designer tester waitprocess completed

 

Now if you go to the path specified for the created file in the Write File activity, you will see that contents have been written successfully as shown in the screenshot below:

tibco tester data in file

 

 

Ajmal Abbasi

Ajmal Hussain Abbasi is a TIBCO Consultant By Profession with more than 6 years experience in TIBCO products. He has extensive practical knowledge of TIBCO Business Works, TIBCO Spotfire, TIBCO BE, EMS and TIBCO ActiveSpaces. He has worked on a number of highly critical integration projects in Telecom sector by using his skills in Tibco Designer, Adapters, TIBCO EMS, RV, Administrator, TIBCO BE, TIBCO ActiveSpaces etc. Ajmal Abbasi is also experienced in developing solutions using Oracle PL/Sql, Linux and Java. You can contact Ajmal Abbasi for Consultancy, Technical Assistance and Technical Discussions.

More Posts - Website - Facebook - LinkedIn

Leave a Reply

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