TIBCO Java Code Tutorial: How to add Custom Java Code In TIBCO BW Process

By | June 25, 2014

While developing TIBCO BW processes in designer, you can add custom java code using Java Code activity which is available in Java Palette. In this step by step tutorial, you will learn how to add and execute custom java code in TIBCO.

Step 1: Create Process with Java Code activity

In this tutorial we will create a simple process which will take age as an input and It will use Java Code to return a status based on the value of the age.

The process will have a Java Code activity between its start and end activity.

In the output editor tab of Start activity, create an integer type element to get age as input as shown below:

java code start activity output editor

Next, we need to add parameters to Java Code activity. For this, in the configuration tab of Java Code activity, add Input and Output parameters as shown below:

java code configuration add parameters

Next we move to Code tab of Java Code activity. If you click on the option of Full Class, you will see that getter and setter methods for the parameters are automatically created. These getter and setter methods are executed by the engine before invoke method.

The code changes that we need to perform should be inside the invoke method.  In our example case, I am simply checking the age and if age is above 18, status is set as Valid otherwise its value will be invalid. Code written inside invoke method is shown below:

java code invoke method body

After making changes to invoke method body, we need to compile the class using compile button. As you can see below, code has compiled successfully:

java code compile

 

Now we are done with the process implementation. Let’s move forward with the testing of process.

 

Step 2: Test Java Code in TIBCO Designer Process

Validate the process and once it has validated successfully, load the process in designer tester.  You will be asked to provide age input value. Provide some integer value to this field in the similar way as shown below:

java code process start input

As we gave 45 as age input, you can see in the below screenshot that Java Code has run successfully and we have got “valid” in the status field as output:

tester java code output

 

 

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

2 thoughts on “TIBCO Java Code Tutorial: How to add Custom Java Code In TIBCO BW Process

  1. Aakash

    This tutorial is awesome… Thanks a lots for the effort you have put!!!

    Reply
  2. Pingback: How to Call Java Class Methods in TIBCO By Adding JAR File: Step By Step Tutorial | Tibco Guide

Leave a Reply

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