BPEL process

This view shows the BPEL constructs and data structure that are used to implement the library process in Business Process Choreographer.

Data structure

Even more important than to understand the structure of the process is to understand the data structure that is used in the library sample.

The asset of the library is described by an instance of the library_asset data structure. It consists of three lists, one of books, one of users and one of book instances.

A user is defined by a name, an email address, and an user Id.

A book is described by a title, an author, an abstract, and a book Id.

A book can be present multiple times in the library, for each copy of the book there is a book_instance object.  A book instance consists of a book Id and a book instance Id.

When a book instance is lent-out the state of the book instances changes from "onShelf " to "lendOut" and the user_id is set to the user that has borrowed the book instance. When the book instance is returned the user_id is cleared.

 

Library asset data structure

Process structure

The mapping from the activity diagram to the actual BPEL constructs is quite straight-forward.

The library process receives a lend-out request from a library user in the LendBookReceive activity. The request message contains the book Id of the book to lend and the user Id of the current user. These two Ids also serve as correlation set of the process. The library process uses a data typed variable in the LendBookReceive activity with the following structure:

The library process reads all library data in a process variable. To keep the sample simple this is done by the assign activity ReadLibraryAsset that copies static information into the library_asset variable.

The checking whether the requested book is available is done in the link condition of the link that leads from ReadLibraryAsset to the BookAvailable sequence.

The link from ReadLibraryAsset to the BookUnAvailable sequence activity has a link condition of otherwise.

In the left branch the process waits for the book to be returned or the lend-out period to pass by. This is implemented by the receive choice (or pick) activity: WaitForBookToBeReturned.

If the book is not returned in time, the issue is brought to the attention of a library administrator. This is achieved by the staff activity LendPeriodExpired.

 

Library process