The repeat activity repeats a complex activity without recursion. It directs Sterling B2B Integrator to return to the beginning of a parent or child state, or to run an activity again.
The repeat activity can be used only as a child activity of the complex activity that it references.
The repeat element accepts the ref attribute, which names the complex activity to be repeated. The activity to be repeated must be a complex activity that contains (directly or indirectly) the repeat activity.
In the following example, the repeat element is directly contained in the proceed sequence, which is contained in the choice element. This means that the choice sequence indirectly contains the repeat element.
<process name='repeat'> <rule name='checkX'> <condition>X true = </condition> </rule> <sequence> <assign to='X'>true</assign> <choice name='loop'> <select> <case ref="checkX" activity="proceed"/> </select> <sequence name="proceed"> <operation name='…'> … </operation> … <repeat ref='loop' /> </sequence> </choice> </sequence> </process>
In this example, X is set to true. The choice element checks for the value X. Because X is true, the activities that are part of the proceed sequence begin to run. The last activity in the sequence is the repeat. The repeat activity refers to the choice named loop, so the process tries to run the choice activity again. If X is still true, the proceed sequence runs again. The sequence continues to repeat until X changes and becomes false. If X does not change to false, the process runs indefinitely, in an infinite loop.