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 generalized flow activities

Resolving modeling errors in generalized flow activities

When modeling generalized flows there are some common mistakes that can occur. Simple steps to deal with these problems are described.

The generalized flow activity allows mixing of cycles and parallelism within the same flow. Standard BPEL is based on building blocks represented by structured activities. Sound modeling is ensured by separating cycles and parallelism into different structured activities. Therefore generalized flow activities allow the possibility of errors that cannot occur in standard BPEL implementations.

With a generalized flow activity you can create unsound process models. Such models will fail at run time. To avoid runtime problems, each process model is analyzed when you save it if a modeling error is noted an appropriate error will be reported. Use the suggestions in this topic to resolve such errors.

For simplicity, only empty actions are used in the following examples. The type of activity in the generalized flow is irrelevant to the explanation of modeling errors.


Definition of region. A "region" is a part of the BPEL process containing activities and links. An area in the process model that has a single entry link and a single exit link is called a SESE-regions (Single Entry - Single Exit).

Figure 1 provides an example of a process model with multiple SESE-regions.

Figure 1. An example of a generalized flow with multiple SESE-regions.

Here is the same figure with the SESE-regions identified.

Figure 2. An example of a generalized flow with multiple SESE-regions.

Each activity with one incoming link and one outgoing link is a simple SESE region. In this example RegionA4 and RegionA6 are SESE regions. There are three additional regions of interest. First there is RegionA3 consisting of Activity3 and the LoopBack link forming a cycle. Second there is the ÍnnerRegion consisting of Activity2, Activitiy5, RegionA3, RegionA4 and all links connecting those activities and regions. And third, there is the OuterRegion consisting of Activity1, Activity7, the InnerRegion, RegionA6 and all links connecting those activities and regions.


Types of regions. A region can be categorized into four types – cyclic region, parallel region, neutral region and unsound region. This categorization is made upon the directly enclosed gateways and the contained graph structure.


Cyclic regions A cyclic region contains one or more cycles and the following gateway types: Split, Merge and converging Inclusive OR. RegionA3 is an example of a cyclic region.


Parallel regions. A parallel region can contain the following gateway types: Fork, Join, and diverging as well as converging Inclusive OR gateways. If that the categorization is made upon the directly enclosed gateways, regions that are nested within a region do not contribute to the categorization. For the OuterRegion only the Fork gateway of Activitiy1 and the Join gateway at Activity7 define the region type. The Split and Merge gateways contained in the InnerRegion and RegionA3 do not contribute to the categorization of the OuterRegion. The OuterRegion in the above example is a parallel region. Parallel regions do not contain cycles, although they may contain nested regions which do contain cycles.


Neutral regions. Neutral regions either contain

Neutral regions can run as cyclic regions or parallel regions. The runtime environment decides which type is applied to those regions. Examples of neutral regions are RegionA4, RegionA6 and the InnerRegion. In this case the runtime environment will apply region type "cyclic" for the InnerRegion and RegionA4 because RegionsA3 is cyclic. The runtime environment assigns region type "parallel" for RegionA6 as part of the OuterRegion.


Unsound regions Unsound regions contain a mixture of exclusive gateways (Split and Merge) and parallel gateways (Fork, Join, diverging Inclusive OR). A process model containing unsound regions is categorized cannot be run in the runtime environment. Examples of unsound regions are shown below.


Types of unsound process models There are three possible types of unsound model – "deadlock", "lack of synchronization", and "cycles in parallel regions".

A deadlock in a process model occurs when an activity with a synchronized converging gateway (for example a Join) waits for all the incoming links to be navigated, but not all of the links are followed so the activity waits forever. Figure 3 is an example of a process model with a deadlock.

Figure 3. A generalized flow with a deadlock.

At the split gateway at Activity1 the navigation follows one of the two links depending on the condition. The other link is not followed. Assume that the left link is followed, then Activity2 is processed and the outgoing link of Activity2 is followed. Since the right link of the split gateway is not followed, Activity3 is neither run nor skipped and its outgoing link is not followed. The join gateway of Activity4 synchronizes both links, which means that it waits until both links are followed which never happens. The red cross in the lower left corner of the generalized flow indicates that this deadlock situation has been detected and reported as an error.


Lack of synchronization occurs in a process model when an activity with a merge gateway is run multiple times although it should be run only once. This happens when multiple incoming links are followed. Figure 4 is an example of a process model with lack of synchronization

Figure 4. A generalized flow model with a lack of synchronization.

At the fork gateway of Activity1 the navigation follows both links. Therefore Activity2 and Activity3 are processed in parallel. For both of those activities the outgoing links are followed. As soon as one incoming link of the merge gateway is followed, Activity4 is processed. Since both links are followed, Activity4 would run twice. The red cross in the lower left corner of the generalized flow indicates that this lack of synchronization situation has been detected and reported as an error.


Cycles in parallel regions. Cycles are supported only in cyclic regions. If there is a cycle in a parallel region, errors are reported. An example of a cycle in a parallel region is shown in Figure 5.

Figure 5. A generalized flow with a cycle in a parallel region

If you find modeling problems in your generalized flow activities follow the steps below to resolve these issues.


Procedure

  1. To resolve a deadlock or a lack of synchronization.

    An unsound region contains in most cases either a deadlock or lack of synchronization.

    The following error is reported for the deadlock example ( Figure 3): "One region of generalized flow " GeneralizedFlow" is not mappable".

    All activities belonging to the unsound region are listed in the error message so you that you can locate the problem. By looking at the gateways inside that region the type of unsound process model can be determined. By changing the gateway type for one or more gateways or by re-structuring the region, the error can be resolved.

    In our example ( Figure 3) possible solutions are:

    • If Activity4 needs to run after either Activity2 or Activity3 have been processed (determined by the split gateway), the join gateway needs to be changed to a merge or an Inclusive OR gateway.

    • If Activity4 needs to run after both Activity2 and Activity3 have been processed, the Split gateway needs to be changed to a Fork gateway.

    • If Activity4 needs to run only when Activity2 have been processed, the link between Activity3 and Activitiy4 needs to be removed.

    • If Activitiy4 needs to run only when Activity3 have been processed, the link between Activity2 and Activity4 needs to be removed.

    This is not a complete list of solutions, and other may be more appropriate for resolution of your deadlock.

  2. To resolve a cycle in a parallel region.

    For the example ( Figure 5) you would see three error messages, one for each red cross in the figure.

    For example: "The link or activity "Activity2" is participating in a parallel region which contains a cycle". Such a message should alert you that you have a cycle in a parallel region.

    For the example ( Figure 5) possible solutions include:

    • Change the converging gateway at Activitiy2 to a Merge and the diverging gateway at Activity5 to a Split.
    • Remove Link 5, connecting Activity5 with Activity2.

    This is not a complete list of solutions, and others may be more appropriate for resolution of your cycle in a parallel region.

Work with generalized flow activities