WSO2 Business Process Server v3.1.0 Documentation

##### Overview

- Home
- Release Note
- WS-BPEL Compliance
- License

##### Downloads

- Releases

##### Installation Guide

- Installing WSO2 BPS

##### Quick Start Guide

- Modeling the process
- Deploying the process
- Testing the process

##### User Guide

- Deploying BPEL Processes
- Deploying Human Tasks
- Managing BPEL processes
- Managing BPEL process instances
- QoS for BPEL processes
- Securing BPEL processes
- Invoking secured partner services
- Versioning
- Management API

##### Human Task Guide

- Human Tasks Quick Start Guide
- Deploying HumanTasks
- Managing Tasks
- Developing a Human Task Artifact
- Human Task Management and Configuration
- Human Task Concepts

##### Administrator Guide

- External data sources Configuration
- Registry Configuration
- Events
- Unified Endpoints
- BPEL Extensions
- Transaction Factory Configuration
- Message Exchange Interceptors
- OpenJPA specific properties
- JMS Transport Configuration
- Process Instance Cleanup Tasks
- Process Hydration and Dehydration
- Enabling Peer-to-Peer(P2P) Communication
- Setting up a BPS Cluster

##### Best Practices

- Process Deployment Best Practices

##### Concepts

- Process Versioning
- Process instance events
- Partner links

##### WS-BPEL Extensions

- Activity Failure and Recovery
- Extension Activities and Extensible Assign Operations
- XPath Extensions
- Iterable ForEach
- Flexible Assigns
- BPEL4People Extension

##### Samples

- HelloWorld
- If-Else
- ForEach
- While
- Repeat Until
- Flow and Links
- Pick
- Synchronous and Asynchronous Service Invocations
- Fault Handling
- Split
- XslTransform
- Compensation Handler
- Event Handler

##### Resources

- FAQ
- External Articles
- Library
- Source Code

##### Community

- Forum
- Mailing Lists

##### Project Information

- Issue Tracking

# Sample Guide - Flow and Links

### Table of Content

- Objective
- Prerequisites
- Overall Idea

### Objective

The activities defined inside <flow/> can be performed concurrently. But when there are can be dependencies in-between those activities. <links/>, <sources/> and <targets/> are used to define synchronization dependencies in-between those activities.

Let's understand what's meant by <links/>, <sources/> and <targets/>.

In the <flow/>, we define <links/> as follows. These link names can be sources or targets of the activities inside <flow/>

eg -

    <bpel:flow name="EndlessRunningFlowOfPain">
        <bpel:links>
            <bpel:link name="transition1"/>
        </bpel:links>
        <bpel:sequence name="Seq1">
            <bpel:sources>
                <bpel:source linkName="transition1"/>
            </bpel:sources>
            <bpel:empty/>
        </bpel:sequence>
        <bpel:if name="IfDependOnSeq1">
            <bpel:targets>
                <bpel:target linkName="transition1"/>
            </bpel:targets>
            .......
        </bpel:if>
    </bpel:flow>

So using <sources/> and <targets/>, user can specify, IfDependOnSeq1 activity should be executed after Seq1.

i.e Source activity should be executed before Target activity

Note :As well there are other optional constructs to mimic conditional behavior for the <source/> and <target/>. They are

- <transactionCondition/>
  - used in <source/>
  - initialize a logical condition for the source link based on a logical condition.

    eg -

        <invoke...>
            <sources>
             <source linkName="Link1">
                <transitionCondition>
                   $tmpVar=1
                </transitionCondition>
             </source>
            </sources>
            ...
        </invoke>

- <joinCondition/>
  - 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`).

    eg -

        <invoke...>
            <targets>
                <joinCondition>
                    $Link1 and $Link2
                </joinCondition>
                <target linkName="Link1" />
                <target linkName="Link2" />
            </targets>
        </invoke>

### Prerequisites

- Log in into BPS server admin console.
- Under Business Processes -> Add BPEL.
- Upload the TestFlowLinks.zip , (all samples are located at our sample repository.)
- Under the Business Processes -> Processes.
- Under the WSDL details widget -> Create instance

### Overall Idea

Refer - TestFlowLinks.zip

Here the sample tries to implement sequence of activities inside a <flow/>, where there can be 3 execution paths based on the conditions defined in 2 and 5.
Some of the possible execution paths are

- 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