Saturday, May 4, 2013

Parallel flow in BPEL 2.0 –flowN deprecated and replaced by for-each Parallel Execution


In BPEL 1.x ,there was a limited FLowN feature which doesn’t support out of the box dynamic  parallel flows, which was a limitation as far as workflow was considered. But with BPEL 2.0 they have merged Flow with FlowN and it supports to the no.of flows at design time. And the dynamic FlowN has been merged with for-each ,giving an out of the box option to switch between sequential execution and parallel execution of multiple flows. In case each flow contains synchronous invocation of services and each flow is dependent on the others completion then go for sequential execution or else if its more of asynchronous nature and independent of each other make it parallel to save on time
For looping through in For-each BPEL 2.0 its pretty simple syntax, the counterName  can be used as the index variable for looping through each item.
Sequential
    <forEach parallel="no" counterName="forIndex" name="ForEach20">
      <startCounterValue>1</startCounterValue>
      <finalCounterValue>count($inputVariable.payload/client:Employee)</finalCounterValue>
      <scope name="Scope1">
        <variables>
          <variable name="Emp" type="client:EmployeeType"/>
        </variables>
        <assign name="Assign1">
          <copy>
            <from>$inputVariable.payload/client:Employee[$forIndex]</from>
            <to>$Emp</to>
          </copy>
        </assign>
      </scope>
    </forEach>

To make it parallel
    <forEach parallel="yes" counterName="forIndex" name="ForEach20">

Or from UI
  

Sequential flow

Parallel Flow
So easy to execute than in BPEL 1.x. I am loving it.

No comments: