All product information in wiki.bizagi.com is only valid for Bizagi BPM Suite 9.1.X.
For newer Bizagi BPM Suite versions (10.X and up) please visit the User Guide.
 

How To Model Transactions

From Business Process Management, BPM and Workflow Automation Wiki | BizAgi BPMS

Jump to: navigation, search

<keywords content="keywords"> Transaction, transactions, transactional, intermediate </keywords>

How to Model a Transactional Process

Transactional sub processes facilitate the implementation of business scenarios with transactions whose execution could last many days or weeks until the set of activities is completed. As an example, a travel plan process is presented. In this process it is necessary to book a flight, a hotel and a car successfully in order to carry out the planned scenario. If any of the three booking attempts is unsuccessful, those that have been made need to be cancelled.

In this case two processes are needed: the Parent process, called "Travel Plan", and the Transactional process called "Booking" in which the three activities of booking will be modeled.

Transactional Sub process

1. First model the transactional sub process without the compensation activities.



When this is done, model the Compensation Intermediate Events and its Compensation activities: right click on the activity and select Attach event - Compensation from the left menu on the modeler and place it on the corner of the Activity.



Then, click on the User Task from left menu on the modeler and place it near the compensation event, join the event to the new task. When finished, Save the process.



The complete sub process with all the compensation activities will look like this:



2. Create and associate the forms for all activities. This would be an example of a form for the Book Flight activity. Note the highlighted fields, they would be used to determine if an error or cancellation occurred.



3. Include an expression at the OnExit of each activity that has a compensation attach to it. The expression must evaluate if the activity finished with an error, by cancellation or normally.

In this case, the error or cancellation will be evaluated by two attributes: BookFlightFailed and FlightUnavailable (corresponding to the two fields in the form).

If the flight fails, the expression will consider it as an Error. If it is unavailable it will be considered as a cancellation:



Build the rule:



The syntax for the cancellation event is

CHelper.RaiseCancelEndEvent("AnyEventName");

The syntax for the error event is

CHelper.RaiseErrorEndEvent("AnyEventName");


4. The Compensation Activity for the flight, "Cancel Flight", will be activated if the Book Flight activity finished correctly AND; one of the other activities "Book Hotel" or "Book Car" ended in cancellation. The same applies to the "Cancel Hotel" or "Cancel Car" activities.


5. The transactional process should be embedded, so the Booking process should be defined as Module: click on the process Properties, and select Module as Access Type. Then click OK.


Parent Process

Model the Parent process, in this case the "Travel Plan", defining in the Sub Process Wizard the Booking sub process as Transactional.


<videoflash>arNqyuVqzVQ|640|505|</videoflash>

For further information about Transactional Processes go to Transactional <comments />