TIBCO | For Loop - Accumulate output

In this post we will check how TIBCO for loop works. TIBCO provides Group Activity to iterate over processes or activities. Loops can be different types eg. For Loop, While util loop, if loop, repeat on error etc. TIBCO group can loop over sub-process and accumulate output in end activity to be used by next activities.

TIBCO For loop with Accumulate output repeats over process/activity and return output of each iteration in output activity. This is helpful where we want to call sub-process repeatably with different input parameters and store each output in some variable.



Uses of Accumulated Output

  • Loading all cache data at startup using OnStartUp activity.
  • Calling same process/function with different parameters and processing that data at last.

Step 1 : Create a simple process to take input string and output concatenated string.



Process takes input string and we are concatenating input with value out. We will use this process as a sub-process which we will call in repetitive manner. In real life scenario we can replace this process with any other activities such as soap request reply/jms to call other api and output response. We will use this output in calling process.

Step 2 : Create a main process which will call above process.


 

Create a main process named loopTest. Drag and drop above process to call in this process. Then create a group using Create a group button. As we are creating for loop in TIBCO BW process select Group Action as Iterate. We have to provide loop index name to keep track of loop counter. In variable list we have to specify array root element on which we are iterating. This can be different input parameters which will be passed in loop process. We need to check out the Accumulate output input as we require output of each iteration. Also have to provide element name in which all output will be stored.


Just like Java for loop program current value is stored in Iteration element variable - Element name here. 



At last we are mapping accumulated output to end activity. In real life scenario we can store this output in shared variable with the help of OnStartUp activity.





Run the main process and check the output. The output of each iteration is present in DATA_OUT variable(Same has been copied in Data_Element of end activity). 




Comments

Post a Comment

Popular posts from this blog

Spring | Using TIBCO EMS with Spring framework

TIBCO | JNDI Server & JMS Instance creation