As I discussed in the first part of this series of articles, BPEL will allow us to increase the flexibility, agility and efficiency of business process within an organization. Not only business processes, according to this paper(Grid Service Orchestration Using the Business Process Execution Language (BPEL)) WS-BPEL can even be use with scientific workflows. The above paper describes how to orchestrate scientific workflows using WS-BPEL and reliability, performance and scalability that can be achieved by using BPEL to model scientific workflows.
When studying the first example(Figure 1) provide in the WS-BPEL spec, we can see that there can be several types of execution of activities in real world business processes like, sequential executions, parallel executions, synchronizing concurrent activities, fault handling , event handling and etc. As described in the above paper there may be hundreds of parallel executions in scientific workflows written using WS-BPEL.

So in real world applications orchestration modeling language must fulfil following requirements:
- Model serial, parallel, conditional or other kinds of conditional flow dependency patterns
- interact with external services
- Exception handling, transactions and compensation handling
- Data manipulation
- Event handling
WS-BPEL 2.0 which is the evolution of BPEL 1.1 provides following language constructs to handle above mentioned and other advanced requirements in service orchestrations.
State of a BPEL Process
During runtime BPEL business process use typed variables to hold the data that constitute the state of the process. The values contained in such variables can be of two sources: either they come from messages exchanged with a partner, or it is intermediate data that is private to the process.
<variable name="myVar1" messageType="myNS:myWSDLMessageDataType" />
<variable name="myVar1" element="myNS:myXMLElement" />
<variable name="myVar2" type="xsd:string" />
<variable name="myVar2" type="myNS:myComplexType" />
</variables>
Providing and Consuming Web Services
Receive activity, reply activity and invoke activity in BPEL allow exchanging message with external partners. Those simple activities can be used to consume messages from and providing messages to web service partners.
createInstance="yes"
partnerLink="ClientStartUpPLT"
operation="StartProcess" ... />
partnerLink="ClientStartUpPLT"
operation="StartProcess" ... />
partnerLink="BusinessPartnerServiceLink"
operation="partnerOperation" ... />
Structuring Process Logic
Every activity in a workflow must be structured in manner that reflect the real world scenario. So if we need to execute number of activities in sequential manner, we can use BPEL's sequence activity. On the other hand if-else activity allows you to select exactly one branch of the activity from a given set of choices. In BPEL you can use XPath expression to formulate your condition.
<receive name="receiveOrder" ... />
<invoke name="checkPayment" ... />
<invoke name="shippingService" ... />
<reply name="sendConfirmation" ... />
</sequence>
<condition>
$order > 5000
</condition>
<invoke name="calculateTenPercentDiscount" ... />
<elseif>
<condition>
$order > 2500
</condition>
<invok e name="calculateFivePercentDiscount" ... />
</elseif>
<reply name="sendNoDiscountInformation" ... />
</else>
</if>
Repetitive Activities
If you need to execute business logic repeatedly in your BPEL you can use one from activities like while, repeatUntil or forEach. There are two variants of forEach: sequential and parallel. According to your requirements you can use parallel option to execute business logic inside forEach block parallely. For this executions must be independent from each other.
<condition>
$iterations > 3
</condition>
<invoke name="increaseIterationCounter" ... />
</while>
<invoke name="increaseIterationCounter" ... />
<condition>
$iterations > 3
</condition>
</repeatUntil>
<startCounterValue>1</startCounterValue>
<finalCounterValue>5</finalCounterValue>
<scope>
<documentation>check availability of each item ordered</documentation>
<invoke name="checkAvailability" ... />
</scope>
</forEeach>
Related posts brought to you by Yet Another Related Posts Plugin.



0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment