16 Controlling the Process Flow

This chapter briefly describes the different flow objects you can use to control flow in a process. It contains links to the chapters that describe these flow objects with more detail. It also contains a description of the markers you can define for subprocesses.

This chapter includes the following sections:

16.1 Introduction to Controlling the Process Flow

Oracle BPM provides different structures to control the flow of a process. These structures enable you to decide which path a process instance takes based on different conditions.

The structures that allow you to control the flow of a process are:

  • Gateways

  • Timer Events

  • Errors

  • Message Events

  • Send and Receive Tasks

  • Loop Markers

  • Multi-Instance Markers

16.1.1 Gateways

Gateways are flow objects that enable you to fork the flow of a process. Depending on the type of gateway the instance follows one ore more outgoing sequence flows coming out of a gateway, or multiple copies are created to run these branches in parallel.

For more information about gateways, see "BPMN Flow Object Reference" in the Developing Business Processes with Oracle Business Process Composer.

16.1.2 Timer Events

Timer events enable you to define the path a process instance takes based on a time condition. For more information about timer events, see Adding Delays_ Deadlines_ and Time Based Cycles to Your Process.

16.1.3 Errors

Error events enable you to define how a process handles an abnormal situation. You can use error events to define different process flows for each of the errors that may occur in a business process. For more information about error events, see Handling Errors.

16.1.4 Message Events

Message events enable you to define a process flow based on the occurrence of a certain event. Generally you use message events to asynchronously invoke a BPMN process (asynchronous inter-process communication) or an external service such as a BPEL process. For more information about message events, see Communicating With Other BPMN Processes and Services.

16.1.5 Send and Receive Tasks

Message events enable you to define a process flow based on the occurrence of a certain event. Generally you use message events to asynchronously invoke an external service or another BPMN process. For more information about message events, see Communicating With Other BPMN Processes and Services.

16.1.6 Loop Markers

Loop markers enable you to run a subprocess multiple times based on a certain condition. For more information about loop markers, see Introduction to Loop and Multi-Instance Markers in Subprocesses.

16.1.7 Multi-Instance Loop Markers

Multi-instance loop markers enable you to run a subprocess for each of the elements in a set of data. For more information about loop markers, see Introduction to Loop and Multi-Instance Markers in Subprocesses

16.1.8 Suspending the Current Process Flow

You can suspend a flow object, a subprocess or a process. For more information about suspending the current process flow, see Suspending the Current Process Flow to Run an Alternative Process Flow.

16.2 Introduction to Loop and Multi-Instance Markers in Subprocesses

You can configure subprocesses to run multiple times using loop and multi-instance markers. To configure loop and multi-instance makers you must define expressions and conditions that specify how to repeat the subprocess.

Loop Markers

Loop markers enable you to run a subprocess multiple times based on condition. You can configure the loop marker to evaluate the condition before or after running the subprocess. You can also configure the loop marker to stop after a certain number of repetitions.

To configure a loop maker you must write a Loop Condition that determines if the BPMN Service Engine must continue to repeat the subprocess.

Multi-Instance Markers

Multi-Instance markers enable you to run a subprocess for each of the elements on a set of data. When the BPMN Service Engine runs a subprocess with a multi-instance loop marker it creates a set of instances, one for each element on the set of data. You can configure the multi-instance marker to process these instances in parallel or sequentially.

The following fields in a multi-instance loop marker require you to write an expression:

  • Loop Cardinality

    This expression defines the number of tokens to create in the subprocess.

  • Completion Condition

    This expression determines when to stop repeating the subprocess. The BPM Service Engine evaluates this condition every time a token completes the subprocess. If the condition evaluates to true, it considers the subprocess completed and the instance moves to the next flow object in the process.

16.2.1 How to Configure Loop Markers

You can configure a loop marker to run a subprocess multiple times.

To configure loop markers:

  1. Right-click the subprocess.

  2. Select Properties.

  3. Click the Loop Characteristics tab.

  4. Select Loop.

  5. Specify the Loop Condition:

    1. Select the expression language.

      Possible options are Simple or XPath.

    2. In the text area below, write the condition that drives the loop.

      Optionally you can write the condition using the Expression Builder. To launch the Expression Builder click the Expression Builder button next to the text area.

  6. Optionally, you can specify a maximum number of times for the loop to run:

    1. Select Loop Maximum.

    2. Specify a number.

  7. Select before to evaluate the condition before running the flow object, or deselect it to evaluate the condition after running the flow object.

  8. Click OK.

16.2.2 How to Configure Multi-Instance Markers

You can configure a multi-instance marker to run a subprocess multiple times based on a set of data.

To configure multi-instance markers:

  1. Right-click the subprocess.

  2. Select Properties.

  3. Click the Loop Characteristics tab.

  4. Select MultiInstance.

  5. Select the mode:

    • Sequential: specifies that the each token must complete the subprocess before the next token starts to run the subprocess.

    • Parallel: specifies that tokens run in parallel

    Note:

    When using parallel mode consider that using process data objects to store information that results from running the subprocess may result in instances overwriting the information. To avoid this use subprocess data objects.

  6. Specify the Loop Cardinality:

    1. Select the expression language.

      Possible options are Simple or XPath.

    2. In the text area below, write the specifies the loop cardinality.

      Optionally you can write the condition using the Expression Builder. To launch the Expression Builder click the Expression Builder button next to the text area.

  7. Optionally, you can specify the Completion Condition:

    1. Select the expression language.

      Possible options are Simple or XPath.

    2. In the text area below, write the condition that determines if the loop is completed.

      Optionally you can write the condition using the Expression Builder. To launch the Expression Builder click the Expression Builder button next to the text area.

  8. Click the Browse button next to the Loop Data Output field, to specify the data output.

    You can select a data object or an attribute in a complex data object to pass to the subprocess. Generally the selected data object is a collection of items.

  9. Click the Browse button next to the Loop Data Input field, to specify the data input.

    Select a data object or an attribute in a complex data object to assign the result of the subprocess.

  10. Click OK.

16.3 Suspending the Current Process Flow to Run an Alternative Process Flow

To suspend a process you must configure an existing start event of a subprocess or add a new one. When the process instance arrives to the start event of the event subprocess, the main process flow is suspended and the BPM runtime runs the process flow in the even subprocess.

To suspend a flow object or a sub-process you must configure an existing boundary event or add a new one. The boundary event can be a message event, a timer event or a signal event. When the process instance reaches the flow object with the boundary event, the main process flow is suspended and the BPM runtime runs the event handler sequence flow, the alternative sequence flow.

16.3.1 How to Configure a Flow Object to Suspend the Current Process Flow

You can configure boundary events and event subprocesses to suspend the current process flow.

To configure a flow object to suspend the current process flow:

  1. Open the BPMN process.
  2. Right-click the boundary event or subprocess that you want to use to suspend the process flow.
  3. Select Properties.
  4. Select the Implementation tab.
  5. Select the Suspending Event option.

16.3.2 How to Resume the Suspended Process Flow

To resume the process flow you must set the value of the predefined variable action to one of the following values:

  • RESUME

    Resumes the suspended process flow.

  • SEND

    Moves the process instance to the next flow object in the process flow that caught the suspension. The suspended scope is canceled.

You can set the value of the predefined variable action in following ways:

After running a task in an alternative sequence flow, the BPM runtime checks the value of the predefined variable action. If the value of the predefined variable action is RESUME or SEND, it resumes the main process flow and cancels the event handler sequence flow.