When defining BPEL processes, some activities often need to execute more than once. For example, let us suppose that we had a business process that needed to warehouse an array of books. Other examples include performing calculations or invoking partner web service operations several times, and so on.
In BPEL, we can choose between three types of loops:
The
<while>
loopsThe
<repeatUntil>
loopsThe
<forEach>
loops
The <while>
and <repeatUntil>
loops are very similar to other programming languages. The <forEach>
loop can also be found in some programming languages. In BPEL, <forEach>
also provides the ability to start the loop instances in parallel, which can be very useful.
Let us now look at the <while>
loop.