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.
About this task
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
- Drop a parallel activity onto the canvas.
- Populate the parallel activity with the activities required
to create the parallel flow.
- Link them up as follows:
- 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.
- Create the necessary links between each of the nested
activities. When you are done, there should be a clear control path
through the activities.
- Create any necessary conditions as follows:
- Click the link to highlight it.
- In the Details page of the properties
area, click Create a new condition.
- 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.
Note: 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.
Note that the confirmation activity cannot complete until all activities
on both paths have been executed.
Note: 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:
- on outgoing gateways all links are followed if their evaluation
condition is true,
- on incoming gateways the process waits for all incoming links
before proceeding.
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.