This documentation is for WSO2 Enterprise Integrator version 6.5.0 . View documentation for the latest release in the 6.x.x family and the latest release in the 7.x.x family.

All docs This doc
||
Skip to end of metadata
Go to start of metadata

This sample explains the usage of flows and links.

Usually, the activities defined inside a <flow/> element can be performed concurrently, but there can be dependencies in-between activities. <links/>, <sources/> and <targets/> are used to define synchronization dependencies in-between these activities. For more details about <links/>, <sources/> and <targets/>, see the content below. 

<links/> can be defined in the <flow/> element as seen below. The link names can be sources or targets of the activities inside <flow/>.

<bpel:flowname="EndlessRunningFlowOfPain">
   <bpel:links><bpel:linkname="transition1"/></bpel:links>
   <bpel:sequencename="Seq1">
        <bpel:sources>
            <bpel:sourcelinkName="transition1"/>
        </bpel:sources>
        <bpel:empty/>
   </bpel:sequence>
   <bpel:ifname="IfDependOnSeq1">
        <bpel:targets>
            <bpel:targetlinkName="transition1"/>
        </bpel:targets> ....... 
   </bpel:if>
</bpel:flow>

Using <sources/> and <targets/>, you can specify "IfDependOnSeq1" activity that should be executed after Seq1. Which means the Source activity should be executed before Target activity.

There are optional constructs to mimic conditional behavior for the <source/> and <target/> as follows:

    • used in <source/>
    • initializes a logical condition for the source link based on a logical condition. For example,
<invoke...><sources><sourcelinkName="Link1"><transitionCondition>
           $tmpVar=1
        </transitionCondition></source></sources>
    ...    
</invoke>
    • used in <targets/>
    • evaluates a logical condition
    • if the logical condition is true, then all the incoming sources for the defined <target/> should be true.
    • if the logical condition is false, a joinFailure exception will be thrown (Unless the target activity hasn't suppressJoinFailure=true). For example,
<invoke...>
   <targets>
     <joinCondition>
            $Link1 and $Link2
     </joinCondition>
     <targetlinkName="Link1"/>
     <targetlinkName="Link2"/>
   </targets>
</invoke>

WSO2 BPS provides a sample, which can be deployed and executed to understand the constructs. Follow the instructions below to deploy and trigger the process.

1. Log in into BPS server management console and select "Processes -> Add" under the "Main" menu.

2. Upload the <EI_HOME>/samples/business-process/bpel/FlowLinks.zip directory. 

3. In the "Deployed Processes" window, click the "Process ID" to access its "Process Information" window.

4. Under the "WSDL Details" widget, trigger the process using the "TryIt" link to create an instance of it.

Refer to FlowLinks.zip. The following diagram depicts its usage:

The sample implements a sequence of activities inside a <flow/> element, where there can be 3 execution paths based on the conditions defined in 2 and 5 in the diagram. Some of the possible execution paths are as follows.

  • If TransitionResolver's if condition is true and TransitionResolver2's if condition is true
    • 1 -> 2 -> 4 -> 5 -> 6
    • 3
  • If TransitionResolver's elseIf condition is true and TransitionResolver2's if condition is true
    • 1 -> 2 -> 3
    • 4 -> 5 -> 6
  • If TransitionResolver/s if condition is true and TransitionResolver2's if condition is false
    • 1 -> 2 -> 4 -> 5
    • 3
    • 6
  • No labels