Tuesday, 25 March 2014

FlowN activity in SOA Bpel 11g

FlowN activity used to invoke services parallel. It is especially useful when you need several time-consuming and independent tasks.

Please note the below statement which is important in running your flowN activity :

Often this activity is used to split up a message into parts and process those parts simultaneously. When using FlowN it is advisable to put a scope inside and use local variables. If you neglect to do that, the results can be different from what you might expect.
  



Below is  logic for flowN:

<scope name="Scope1">
      <variables>
        <variable name="Variable_bpel1" type="xsd:int"/>
        <variable name="Index_var" type="xsd:int"/>
      </variables>
      <sequence>
        <assign name="Assign_loop">
          <copy>
            <from expression="3"/>
            <to variable="Variable_bpel1"/>
          </copy>
          <copy>
            <from expression="1"/>
            <to variable="Index_var"/>
          </copy>
        </assign>
        <bpelx:flowN name="FlowN1" N="bpws:getVariableData('Variable_bpel1')"
                     indexVariable="Index_var">

          <sequence name="Sequence1">
            <assign name="Assign1">
              <copy>
                <from variable="inputVariable" part="payload"
                      query="/client:process/client:input"/>
                <to variable="Invoke1_process_InputVariable" part="payload"
                    query="/ns1:process/ns1:input"/>
              </copy>
            </assign>
            <invoke name="Invoke1" inputVariable="Invoke1_process_InputVariable"
                    outputVariable="Invoke1_process_OutputVariable"
                    partnerLink="PartnerLink1" portType="ns1:testbpel1sync"
                    operation="process" bpelx:invokeAsDetail="no"/>
          </sequence>
        </bpelx:flowN>
      </sequence>
    </scope>

Key Points:

1>Variables to invoke must be placed inside local scope activity.Check variables marked in blue.If someone dont create local one for invoke activity it will result in redundant information.

23>Place the logic  inside flowN.

4>For passing different xml payload in each loop ,one can follow the below simple logic :

query="/ns1:ListOfData/ns1:Data[$Index_var]/ns1:name"/> 



 

Happy Programming!!!

No comments:

Post a Comment