Developing BPL Processes
List of BPL Elements
[Back] [Next]
Go to:

This chapter divides BPL elements into functional groups and explains the purpose of each element:

Business Process
A BPL document consists of a <process> element and its various child elements. The <process> element is the container for the business process.
Execution Context
The life cycle of a business process requires it to have certain state information saved to disk and restored from disk, whenever the business process suspends or resumes execution. This feature is especially important for long-running business processes, which may take days or weeks to complete.
A BPL business process supports the business process life cycle with a group of variables known as the execution context. The variables in the execution context are automatically saved and restored each time the BPL business process suspends and resumes execution. The variables are:
Most of the execution context variables are automatically defined for the business process. The exception to this rule is the general-purpose container object called context, which a BPL developer defines by providing <context>, <property>, and <parameters> elements at the beginning of the BPL document.
For complete details on these variables, see the Ensemble Business Process Language Reference.
Also see documentation of the <assign> element and see Business Process Execution Context.”
Control Flow
Within a business process, activities are either executed sequentially or in parallel:
BPL includes a number of control flow elements that you can use to control the order of execution inside a BPL business process.
BPL Element Purpose Description
<branch> Branch Conditionally cause an immediate change in the flow of execution.
<break> Loop Break out of a loop and exit the loop activity.
<continue> Loop Jump to the next iteration within a loop, without exiting the loop.
<flow> Group Perform activities in a non-determinate order.
<foreach> Loop Define a sequence of activities to be executed iteratively.
<if> Branch Evaluate a condition and perform one action if true, another if false.
<label> Branch Provide a destination for a conditional branch operation.
<sequence> Group Organize one or more calls to other business operations and business processes. Structures parts of the BPL diagram.
<switch> Branch Evaluate a set of conditions to determine which of several actions to perform.
<until> Loop Define a sequence of activities to be repeatedly executed until a condition is true.
<while> Loop Define a sequence of activities to be repeatedly executed as long as a condition is true.
BPL business process code can initiate a sudden, but graceful exit by setting the business process execution context variable status to a failure value using an <assign> or <code> statement.
BPL includes elements that allow you to make synchronous and asynchronous requests to business operations, and to other business processes.
BPL Element Purpose
<call> Send a request and (optionally) receive a response from a business operation or business process. The call may be synchronous or asynchronous.
<request> Prepare the request for a call to another business operation or business process.
<response> Receive the response returned from a call to another business operation or business process.
<sync> Wait for a response from one or more asynchronous calls to other business operations and business processes.
<reply> Return a primary response from the business process before execution of the process is fully complete.
The <delay> element can be used to delay execution of a business process for a specified duration or until a future time.
Rules and Decisions
The <rule> element executes a business rule. This element specifies the business rule name, plus parameters to hold the result of the decision and (optionally) the reason for that result.
The parameters for the <rule> element can include any property in the general-purpose execution context variable called context. Therefore, a typical design approach, for a business process that invokes a rule, is to ensure that the business process accomplishes the following:
  1. Provides <property> and <context> elements so that the context object contains properties with appropriate names and types.
    For example, if the rule determines eligibility for a state education loan, you might add properties such as Age, State, and Income.
  2. Gathers values for the properties in whatever way you wish, for example by sending requests to business operations or business processes, and as responses return, assigning values to the properties in context.
  3. Provides a <rule> element that invokes a business rule that returns an answer based on these input values.
For details on the execution context variables, see Business Process Execution Context earlier in this book.
For information on creating business rules, see Developing Business Rules.
Data Manipulation
BPL includes several elements that allow you to move data from one location to another. For example, a typical business process makes a series of calls to business operations or other business processes. To set up these calls, as well as to process the data they return, the business process shuffles data between the various execution context variables — context, request, response, and others. This “shuffling” and other data manipulation tasks are accomplished using the elements described below.
BPL Element Purpose
<assign> Assign a value to a property.
<sql> Execute an embedded SQL SELECT statement.
<transform> Transform one object into another using a data transformation.
<xpath> Evaluate XPath expressions on a target XML document.
<xslt> Execute an XSLT transformation to modify a data stream.
User-written Code
For cases where BPL is not expressive enough to solve a specific problem, Ensemble provides mechanisms to embed user-written code within the automatically generated business process code.
BPL Element Purpose
<code> Allows you to specify the required code within a CDATA block.
<empty> Performs no action; acts as a placeholder until code can be written.
BPL includes elements you can use to log informational and error messages.
BPL Element Purpose
<alert> Write a text message to an external alert mechanism.
<milestone> Store a message to acknowledge a step achieved by a business process.
<trace> Write a text message to a console window and to the Event Log.
Error Handling
BPL includes elements that you can use to throw and catch faults, and perform compensation for errors or faults. These elements are closely interrelated. For details, see the section Handling Errors in BPL in this chapter. The list of elements is as follows:
BPL Element Purpose
<catch> Catch a fault produced by a <throw> element.
<catchall> Catch a fault or system error that does not match any <catch>.
<compensate> Invoke a <compensationhandler> from <catch> or <catchall>.
<compensationhandler> Perform a sequence of activities to undo a previous action.
<compensationhandlers> Contain one or more <compensationhandler> elements.
<faulthandlers> Provide zero or more <catch> and one <catchall> element.
<scope> Wrap a set of activities with its fault and compensation handlers.
<throw> Throw a specific, named fault.