REPEAT Step :
The REPEAT step allows you to conditionally repeat a sequence of child steps based on the success or failure of those steps.You can use REPEAT to :
. Re-excute (retry) a set of steps if any step within the set fails.
.Re-execute a set of steps until one of the steps within the set fails.
.Specifying the REPEAT Condition : Repeat on (FAILURE or SUCCESS) .
.Specifying the REPEAT Counter :
0 : does not re-execute children.
Any value > 0 : re-execute children up to this number of times.
-1 or blank : re-execute children as long as the specified Repeat on condition is true.
Important :
note that the children of a REPEAT always execute at least once. The Counter property specifies the maximum number the children will be re-executed.
Using REPEAT to Retry a Failed Step
If your flow invokes services that access external systems, you can use the REPEAT step to accommodate network errors, such as busy servers or connection errors, at run time. If you use the REPEAT step for this purpose, keep the following points in mind:
The following types of failures satisfy the FAILURE condition:
Expiration of a child step’s Timeout limit
An exception thrown by a Java service
A document query that returns an unpermitted null value
If you specify multiple children under a REPEAT step, the failure of any one of the children will cause the entire set of children to be re-executed.
The REPEAT step immediately exits a set of children at the point of failure (that is, if the second child in a set of three fails, the third child is not executed).
When Repeat on is set to FAILURE, the failure of a child within a REPEAT step does not cause the REPEAT step itself to fail unless the Count limit is also reached.
The Timeout property for the REPEAT step specifies the amount of time in which the entire REPEAT step, including all of its possible iterations, must complete. When you use REPEAT to retry on failure, you may want to leave the Timeout value at 0 (no limit) or set it to a very high value. You can also set the property to the value of a pipeline variable by typing the name of the variable between % symbols.
As a developer, you must be thoroughly familiar with the processes you include within a REPEAT step. Make certain that the child steps you specify can safely be repeated in the event that a failure occurs. You don’t want to use REPEAT if there is the possibility that a single action, such as accepting an order or crediting an account balance, could be applied twice.
Using REPEAT to Retry a Successful Step
Apart from using REPEAT to retry a failed step, you can also use it as a looping device to repeat a series of steps until a failure occurs.
If you use the REPEAT step to re-execute successful child steps, keep the following points in mind:
The success condition is met if all children of the REPEAT step execute without returning a single exception.
If one child in the set fails, the REPEAT step exits at the point of failure, leaving the remaining children unexecuted.
The failure of a child does not cause the REPEAT step to fail; it merely ends the loop.
(In this case, the REPEAT step itself succeeds and execution of the flow proceeds normally).