IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Developing business processes > Building BPEL processes > Defining BPEL process logic > Adding an activity to a BPEL process > Work with structured activities

Work with parallel activities

A parallel process (or flow) is a collection of other process activities that are all nested within a parallel activity. The nested activities run sequentially in an order that is dictated by links and transition conditions (when no links are present, all activities will be executed concurrently). When activities are arranged on separate control paths, the paths will run concurrently.

Parallel activities are very versatile, and can add a depth to a long-running BPEL process. You can use them to run a few simple activities at the same time, or nest entire sub-processes within them. The process is complete after each of the activities have either been executed, or skipped in cases where the enabling condition evaluates to false.

You can create a parallel process as follows:


Procedure

  1. Drop a parallel activity onto the canvas.
  2. Populate the parallel activity with the activities required to create the parallel flow.
  3. Link them up as follows:

    1. Hover your mouse pointer over the source activity until a yellow circle appears below it as shown in the image . Click the yellow circle, and drag the link to the source activity and release the mouse button.

      Alternatively you can right click an activity and select Add link from the menu.

    2. Create the necessary links between each of the nested activities. When you are done, there should be a clear control path through the activities.

  4. Create any necessary conditions as follows:

    1. Click the link to highlight it.

    2. In the Details page of the properties area, click Create a new condition.

    3. Configure the condition using the settings on this page.

      You can use a Simple expression language (True, False, or Otherwise) or program the condition using either Java or XPath.

      If you choose Java™, you can use the snippet editor to visually compose the code, or enter it directly into the Java editor yourself.

      The simple expression language is far more limited than XPath or Java, but if the condition you are trying to express can be expressed using the simple language then it is recommended to do so.


Example

Here is an example of a parallel activity that processes a request to open a bank account.

In this process, the request to open a bank account comes in through the receive activity, and is evaluated by a Java snippet (GetCreditRating) to determine the customer's credit score. It is the credit score that determines how the process will proceed from here on in. After the credit rating is obtained the flow passes through a gateway (denoted by a diamond) which commences the parallel region of the flow. The subsequent links have transition conditions (the circular symbol on the link indicates that the link has an evaluation condition). If the score is too low, then that path to SetAnswerReject is followed, and this Java snippet activity rejects the request. If however, the score is acceptable, then the process flows through both of the other links concurrently (they are both set to "otherwise"). Each of the activities on each of these paths are executed at the same time, and then account status is confirmed in the SetAnswerConfirm activity. If that the confirmation activity cannot complete until all activities on both paths have been executed.

Where the control flow branches or merges, a gateway is created. The nature of a parallel activity is that the semantics of the gateway are not configurable:

If your process requires more flexibility, consider using a generalized flow, which support parallel processes, but also permit gateway semantics to be modified to your needs. See related tasks for more information.

Work with structured activities

Building BPEL processes


Related tasks:
Work with structured activities
Linking activities within parallel and generalized flow activities
Work with generalized flow activities