Preface
The TIBCO Flogo for TIBCO BusinessWorks Developers series of articles aims to familiarize BusinessWorks developers with TIBCO Flogo in order to better utilize these complementary technologies. Each article is focused on a specific key common behavior or feature that is often used in a BusinessWorks project. It takes that common behavior and replicates that in Flogo.
Shared Variable
In this article, we will take a look at the Shared Variable. The Shared Variable has been around in BusinessWorks to allow developers to store values that persists across a process or job. A variable that can persist across a job is called a Job Shared Variable. A variable that persist across jobs within the engine is called a Shared Variable in BusinessWorks 5 (BW5) and a Module Shared Variable in BusinessWorks 6 family (BW6/CE).
To set the stage, we will create a simple project in both BW5 and BW6/CE which uses both Job Shared Variable and Shared Variable. The project has a simple MainProcess which is kicked off by a Timer every 15 seconds. In each execution, it will retrieve a String Job Shared Variable, a String Shared Variable and a Complex Schema Shared Variable and print out the values in it. After printing out the value, it will set a new value to each.
BW5
BW6/CE
The first two variables are of type of string. The third variable is a complex schema shown below.
BW5
BW6/CE
The three variables are initialized to with values of “InitialValue”.
BW5
BW6/CE
The expected output of this project is that it will print out the “InitialValue” for each variable in the first run of the timer. We set a new value to the variables to “ModifiedValue” during the initial run. For the subsequent run, it is expected that the String Job Shared Variable will still print “InitialValue” because the Job Shared Variable does not persist its value across jobs. However, The String Shared Variable and the Complex Shared Variable will now print “ModifiedValue”. This behavior can be seen below.
BW5
BW6/CE
To implement this in Flogo, the method is quite similar. We create a flow in Flogo which can house the activities to perform the same functions as the BW MainProcess. A process in BW can be equated to a Flow in Flogo.
We also define a Complex Schema for use in the ComplexSchemaSV. It should be noted that schema in BW is defined in XML. However, schemas in Flogo are JSON based. Additionally the name of Shared Variable is equated to Shared Data in Flogo.
We use an onStartup_Flow to initialize the value for all three variables.
Running this, we can see below that the exact behavior of the Shared Variable done in the BW project above can be produced in Flogo.
All three projects coded in BW 5.15.1, BWCE 2.9.1 and Flogo 2.24.0 using the Visual Studio Code Extension are attached below for your reference.
BW_5_15_1-BW2F-SharedVariable.zip BWCE_2_9_1-BW2F-SharedVariable.zip BW2F-SharedVariable.flogo
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now