Developer Guide to the BPEL Designer

Using a Termination Handler

When to Use

The termination handler is used to control the termination of a running scope. The termination of a running scope happens if a scope or process enclosing it has faulted.

When a fault is thrown inside a scope or process, a fault handler associated with the scope or process should be run, but before that all the running activities inside the faulted scope or process should be terminated. If a faulted scope or process has any enclosed scopes which are still running, they also should be terminated. Terminating a scope means terminating activities inside it and executing the termination handler associated with the scope.

Note that a scope can be terminated only if, it is either running normally, is running its compensation handler or termination handler. A completed scope as well as a scope that is faulted or is running its fault handlers cannot be terminated.

The termination handler is a container for the activities that will be performed in case a scope is terminated. You can add one termination handler for a scope.

If a fault occurs inside the termination handler of a scope, the fault is not propagated to the enclosing scope.

ProcedureTo add a Termination Handler to Scope or Process elements:

  1. In the Design view right-click the Scope element and choose Add > Termination Handler. An empty container element appears.

  2. From the Palette, drag one or several activities that will be executed and place them inside the Termination Handler container. Configure the properties of each activity.


    Note –

    You do not have to configure any properties for the termination handler.