How to Run Additional Activities While a Process is Running

19-4 Modeling and Implementation Guide for Oracle Business Process Management 1. The BPMN Service Engine runs a task that starts a service that can throw an exception. 2. The task fails with a SOAP error that the BPMN Service Engine converts into an exception. 3. If the task has a boundary catch error event attached, then the instance follows the flow defined by the boundary catch error event to handle the exception. The exception handling flow may resume the main process flow. If it does not resume the main process flow, then the process ends in the boundary catch error event. If the task does not have a boundary catch error event associated with it, then the exception propagates to the process level. 4. At the process level, the following options are possible: ■ If the process does not contain an event subprocess that can catch the exception and you did not define a fault policy, then the BPM Service Engine logs this error to the Oracle Enterprise Manager fault recovery system. See Oracle Fusion Middleware Administrators Guide for Oracle SOA Suite and Oracle Business Process Management Suite for more information about the Oracle Enterprise Manager fault recovery system. ■ If the process contains an event subprocess with a start event of type error configured to catch that exception, then the instance continues through the exception handling flow. When the instance completes the exception handling flow, the process ends.

19.4.2 Typical Flow of an Exception in a Subprocess

The following sequence describes what happens when the BPMN Service Engine runs a subprocess that causes an exception. 1. The BPM Service Engine runs a subprocess that contains a task that invokes a service that can throw an exception, or an end error event. 2. One of these events happens: ■ The task throws an exception. ■ The subprocess ends with an error event. 3. If the exception occurs in a task and the task has a boundary catch error event or the subprocess contains an event subprocess that can handle the exception, then the exception does not propagated to the parent process. If the subprocess ends with an error event, or the exception occurs in a task and is not handled, then the exception propagates to the parent process. 4. The parent process can handle the exception if: ■ the subprocess has a boundary catch event attached. ■ it contains an event subprocess configured to catch the exception. If the parent process cannot handle the exception, then it propagates it to its parent process. If there is no parent process, then the exception is logged to the Enterprise Manager fault recovery system. See Oracle Fusion Middleware Administrators Guide for Oracle SOA Suite and Oracle Business Process Management Suite, for more information about the Enterprise Manager fault recovery system. Handling Errors 19-5

19.4.3 Typical Flow of an Exception in a Reusable Process

The following sequence describes what happens when the BPMN Service Engine runs a call activity that invokes a reusable subprocess that causes an exception.

1. The BPM Service Engine runs a reusable process that contains a task that invokes a

service that can throw an exception, or an end error event.

2. One of these events happens:

■ The task throws an exception. ■ The reusable process ends with an error event.

3. If the exception occurs in a task and the task has a boundary catch error event or

the reusable process contains an event subprocess that can handle the exception, then the exception does not propagated to the parent process. If the subprocess ends with an error event, or the exception occurs in a task and is not handled, then the exception propagates to the parent process.

4. The parent process can handle the exception if:

■ the call activity has a boundary catch event attached. ■ it contains an event subprocess configured to catch the exception. If the parent process cannot handle the exception, then it propagates it to its parent process. If there is no parent process, then the exception is logged to the Enterprise Manager fault recovery system. See Oracle Fusion Middleware Administrators Guide for Oracle SOA Suite and Oracle Business Process Management Suite, for more information about the Enterprise Manager fault recovery system.

19.5 Handling Exceptions in a Business Process

You can handle the exceptions that occur in an activity using the following: ■ A boundary error catch event ■ An event subprocess Boundary error catch events enable you to resume the main process flow after handling the exception. If you want to reuse the exception handling flow for multiple tasks in your process, then event subprocesses are more efficient than boundary catch events. Event subprocesses enable you to define a cleaner process with less effort because the catch error event is located within the event subprocess. To reuse an exception handling flow using boundary catch events, you must define a boundary catch event for each of the tasks, and then connect those boundary events to the exception handling flow. Figure 19–1 shows a process that handles an error using a boundary error catch event.