Jump to content
  • TIBCO Flogo for TIBCO BusinessWorks Developers - Shared Variable


    JenVay Chong

    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 

    yFLjzaT5MGS3QdZMcO1QVOjU87X9w-s4BUT154RUT9tEkfR4jZh2oP6EaZR_8CJDeL-yQYQKz3jTb8fs76VNhAYnVvC7spRE6qVNrAjvL34RoGWTbaayv0zk1txiin8GyrQbHHIKbHre_Z8k9XQZTk8

    BW6/CE

    YHxHbdLSHMVM2p8xFglmBP7iS42mr2Hpp8Krj8HE0ePHCVrBtOS00QeSBGVkDMxzBZ6RkOjhoF_JoMMk85wahs8VR2QM6U6FkzfNR2qOxnqy0oO6aWylTRGdru_AI03MnQX5nwVvBBiEgK9AdOFWfQo

    The first two variables are of type of string. The third variable is a complex schema shown below.

    BW5

    exdQQAmtHUPjxJxbLLsULt3XMX_YeXP9gmzAzPg2ueqSXYxe-OoQ7g28hP6iLg8UgGeGV_dB7OyRibMOC4arl6aNSwDRKvn_SLkGAc1NaRn15uMyNVVTjT6vMY67oVj7EZhxE8NmxZWZh7y20fzXIwk

    BW6/CE

    jQgh_tjvaNj9gWqbqo4Cx8-_d-5xfEtP3-0ABwgASlntiSpmy9gbv8q2FhRNowYxc4N-JxjtB2ogXHspYIzDBSKyRhPeOJLq3fI-Lt5-hV9tTYwUt4oSR6YaHTQMEWcfwo7IasTfwZU9uzu0y-dou9A

    The three variables are initialized to with values of “InitialValue”.

    BW5

    A_s8Ye7xTx0HTGgZrjLIKu_iJ-XQIXpAPD96KHcY7w2418v_-OsTbiYc024ZKDa32XD3jYLwy0LdYQquJeaPYnEDsS8aQ-YI3XtK98jzXanKWM5T6NJcNEDIDHlftMRUDHpPMLLaLUceWnkxfgDwK9o

    6Mep_NO6mzkmTg_a5KZNbjADupwM16bJAynIhJq0--Rr5VtzuoaC2lIdyomwjB9nWcc8mDmoxGn8FL5rPjqPcNwsqxJiV-uoGMTaHQls7CN9JykxHQq4zYxzYAdxZ5atSLUShHUxTUYSbpLNE8rE0oQ

    BW6/CE

    DZpvc3Tq7H9TaLMyHYPgwMuCg8HgG9U5n9ALKkvbm-mTYeTlxSLp-_F1wqbDUfyNGYiAqfGEtSA0ETX9guVaE1PTRPV5c_OIRsZqgR3PUeNtbx-JujTywjOlx4QYK98WxsooxZgG8wwLLKjp_vuq45o

    -xFZ_dvTV9xRlae17BHlGoEaFQcvDGF7PZvQRweooLHpJOa-DlQUtt9EgYOK4FOXfIR2_f_QE0wQpmD8sCnB8mGU5Xb2ZSM7QbLzNZDfdLBU4j3-7qJz1HZdCFB4Bm27ekPU6RtrMsiUYzMRuJ0io_k

    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

    LmIyU80gqjOq2ZCaY5QQXU85H4eYiPGNBGRFnuAsdb8Odos5cOFPKJTvokkq2trzHVcIc9jGJR55v7Bu1auy4MkI1UAx2GejIDW4EouKr03OziR2nSvB81vC8kYaxal2ADkYELyzv7uXSoIBljeVKlc

    BW6/CE

    ss7oiqHnWpasiiI4mQ2T3c4jYGtYq_dW8r8tG-dYe80GYcmoDMIH8rxLnw6p_8d6lkkcoxHI4IcM1U3EatBFC6U3scVQE6nRqC8zhTwi9q-WWGXh5F-PmI5NjdiNulLgwoHcaTciR_5AXZTplik6Xiw

    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.

    ozYiQjG3Gj44D4rgReYzj7DwOv31M6BBSr4sWraEEXcF3HtRSkZi48HdrWJ70Ld_KaclcwYfajI3BMIDsAPtmnB5aooZrc8wC-LG2JyMzXTQmbQI_vl3GxHAIkuRFCfvMLkvHJzaAw1VFy84RhpZlQQ

    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.

    7XlnyqK4gdSU2DlXr9hEGNwEZUzT7TF_6McrdBBhJL-Rjn-0p6e3i557TdMmwF1N2rsyMFJR_T5cz7FQONgptPpXfhxvEz5c6P0k4nYwygqNatEAEVsZN98vkhwsedW4frdMe7Se_Xu15U4hAm3c0F4

    We use an onStartup_Flow to initialize the value for all three variables.

    Y9gq_LN5ApQVJWUjTTCd4SaOoc3M0TQ1IhyrfpptlBty9K191QX8tBW7RrwsLKjEQmnLOhMCXH4nTntlgGGDt1HO0hwzyyWRAyk_d2gVWXhM8EpZI0_h09I67bRi0usoZVCWweW3Grurpwyuco9sAoI

    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.

    Wq-ThDmaXapaAdMk9-DOibBpbschF9pOYuCtmKz7_LESNMggaEJtRnnpgKYmvIQDlu3OXk3CBK7T5ah3V5hAjf-xfyEB_3BunecypXU89t0w77s8-TlFPBW_pjpf3ohd-femmU08yVV0BPE_F8usv10

    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


    User Feedback

    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 account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...