Khanderao on Emerging And Integration Technologies

Monday, April 02, 2007

Parallelism and concurrency in WS-BPEL 2.0

WS-BPEL 2.0 has a better support to parallelism and concurrency.

For example, every iteration in a newly added "forEach" iterator can be run in "parallel". A scopes in a parallel flow can be "isolated" from each other so that they would not step on each other when they manipulates 'global variables'. Similarly, input / output variables of concurrent receive/reply pair can be associated using newly introduced "messageExchange" attribute.

Parallel branches in forEach
Each of the iteration in forEach can be run in parallel if forEach is marked as "parallel" as shown in following example.

<forEach parallel="yes" countername="lineItems">

<startCounterValue>1startCounterValue>

<finalCounterValue>count($order.lineItemss)finalCounterValue>

<scope>

.......

</ scope>

</ forEach>


Isolated scopes:
When activities in isolated scopes access shared variables, they are protected by serializing (completing all such activities in one scope at a time before other).

<process ...>

<variables>

<variable name="TotalAmount" element="..." />

variables>

<flow>

<scope name="Merchandize" isolated="yes">

<sequence>

...

<assign>

<copy>

<from>......from>

<to variable="TotalAmount" />

< /copy>

</assign>

...

</ sequence>

< scope>

< scope name="Shipping" isolated="yes">

< sequence>

...

<assign>

<copy>

<from>......from>

<to variable="TotalAmount" />

< /copy>

</ assign>


MessageExchange:
One to one relationship between inbound message variable to appropriate Concurrent Receive/Request pair can be established by uniquely assigning a messageExchange name as given in following example.


<process ...>

<messageExchanges>

<messageExchange name="supplier" />

<messageExchange name="manufacturer" />

messageExchanges>

...

<flow>

...

<receive messageExchange="supplier"

partnerLink="businessPartner"

portType="businessPT"

operation="updateInfo" />


...

<reply messageExchange="supplier"

partnerLink="businessPartner"

portType="businessPT"

operation="updateInfo"/>

...

<receive messageExchange="manufacturer"

partnerLink="businessPartner"

portType="businessPT"

operation="updateInfo" />

...


<reply messageExchange="manufacturer"

partnerLink="businessPartner"

portType="businessPT"

operation="updateInfo" />

...

</flow>

</process>

Labels:

Add to Technorati Favorites

Save This Page on del.icio.us

0 Comments:

Post a Comment

<< Home