Creating Sub-Process in Tibco BusinessWorks 6

In this article i am going to explain how to create sub process and call that process from main process.

I am using the previous workspace that I already explained in my previous article “Creating Rest Api in Tibco BW 6“.

Now Lets Start

1. Go to the module ->processes->training.module, right-click the training.module then New and then BusinessWorks Sub Process.

bw6-subprocess1

Before creating a sub process why we need this. let’s say you have a complex business process that you want to develop in order to manage your work you create a subprocess like creating a common logging process that will use in all the processes where logging required.

2. By clicking the BusinessWorks Sub Process a new pop up window appears where you provide the process name.

bw6-subprocess3

Provide name and press finish.

A new process appears in your project explorer with Start and End activity.

4. In this process, I am going to write the input values Name and Age in the file. Select the start activity in the properties to select the output editor and then select the schema for inputs by clicking the browse button as highlighted in below picture

bw6-subprocess-4

5. A new popup window appears, select MyRequest schema and press OK. you can see in the output Editor window we have 2 element name and age.

6. Creating file: In the pallet, library click on the file you see the different file operation activities under the file pallet appears, click the write file activity and then click in the process location remember drag-drop not work in BW 6.

In configuration properties, I checked the Append and provide the path of the file in input properties and use concat function in file contents

concat($Start/tns1:name, ‘:>>>’, xsd:string($Start/tns1:age),”&lf;”)

pleae note “&lf;” is a new line feed in tibco xpath.

7. Link the transition lines as show below

bw6-subprocess4

8. The last step is how to call this process from the main process. go back to the main process drag the sub-process to the main post API screen and map the inputs as shown below

bbw6-subprocess7

9: We have completed our development now lets test this and verify. Again I run the project with run configuration. once the application started I again type lrestdoc in the console to get the swagger API definition URL. I am testing the post API with below input request

bw6-subprocess-8

The file created and their contact as shown below

bbw6-subprocess-10

Now i am sending multiple request the content will append in this file

bw6-subprocess-11