Scope Scope

The Scope activity is a key BPEL activity, providing context for other activities, such as fault, compensation handling, variables, and correlation sets contained within it. You can think of it as a { }block in a programming language. A parent Scope can contain child scopes, each with the possiblity of creating their own variables. The primary or parent Scope variables are visible from within the whole process, while variables of the child scopes are not visible to the parent.

You can use a Scope to contain a unit of work, making it easy to manage and execute, and, if necessary, reverse. For example, if a customer cancels a paid ticket order, the money must be returned and the ticket canceled, without affecting other ticket orders. You can use a Scope to manage these activities as a unit.

How does a Scope work?

When a Scope activity executes:

To build a Scope:

  1. From the Palette, drag a Scope activity to the BPEL Editor.
  2. In the Properties view, select Isolated if you want to ensure that variables that are shared by multiple Scopes are not run at the same time.
  3. Right-click the Scope activity on the BPEL Editor to add the following rules and conditions:
  4. From the palette, drag activities to the Scope container and select activity properties.

Properties

Property Description Required?
Isolated Select Isolated to ensure that variables that are shared by different Scopes do not conflict. Because two scopes can run at the same time, the Isolated property makes sure that one scope has access to the shared variables and must finish using them before the concurrently running scope is able to use them.

Isolated scopes cannot contain other isolated scopes, but can contain scopes that are not using the isolated property. In that case, the access to shared variables within each enclosed scope is controlled by the isolated scope.

The Isolation property is not available during compensation.

Yes
Name You can provide a meaningful name to your Scope activity. No

Context Menu Options

Option Description
Add Fault Handler Fault handling reverses or undoes the partial and unsuccessful work of a scope when a fault occurs. How does fault handling differ from compensation? Fault handling takes over when a fault occurs within a scope, and compensation reverses the work of a successfully completed scope. Compensation is not enabled for a scope whose associated fault handler has been invoked. Learn more about fault handling.
Add Event Handler Event handlers enable a running process to react to events that may occur. You can add event handlers to your process, at either the process or scope level. Event handlers run in tandem with a scope and are part of normal scope behavior. When a scope is active the event handler waits for the specified events. They do not take over regular processing like fault or compensation handlers do. See Using Event Handlers.
Add Compensation Handler When a Scope completes without a fault being caught or rethrown, it has completed normally and is eligible for compensation. Business processes use compensation to define an activity, that when executed, reverses some previously executed application logic. See What is Compensation?
Add Add an activity to the Scope activity.
Insert before Select another activity to add to the process before the Scope activity is performed.
Add Variable A BPEL process receives, manipulates, and sends data through variables. You can add a variable to the Scope activity. From the Type Selector dialog box, select the data type you want the variable to use; simple, element declarations, or messages.
Related Topics
Bullet Understanding Activities
Bullet Using Event Handlers
Bullet What is Compensation?
Bullet Using Variables