Sample Guide - Repeat Until

Objective

Explains the functionality of <repeatUntil/> construct, where the repetitive task should be executed at least once. This functionality also can be achieved via <while/>. But how the logical condition used in both cases differs.


Prerequisites

  • Log in into BPS server admin console.
  • Under Business Processes -> Add BPEL.
  • Upload the TestRepeatUntil.zip , (all samples are located at our sample repository.)
  • Under the Business Processes -> Processes.
  • Under the WSDL details widget -> Create instance

Overall Idea

Refer TestRepeatUntil.zip

eg -

<repeatUntil name="RepeatUntil">
    <assign validate="no" name="IncrementCounter">
        <copy>
            <from><![CDATA[$counter + 1]]></from>
            <to variable="counter">
            </to>
        </copy>
    </assign>
    <condition><![CDATA[$counter >= 10]]></condition>
</repeatUntil>

Here we increment counter variable until it's equal to 10.

If you refer TestWhile.zip, the logical condition in <while/> is exactly the negation used in <repeatUntil/> to do the same thing.

eg -

<while name="While">
    <condition><![CDATA[$counter < 10]]></condition>
    <assign validate="no" name="IncrementInput">
        <copy>
            <from><![CDATA[$counter + 1]]></from>
            <to variable="counter">
            </to>
        </copy>
    </assign>
</while>