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 for the current iteration. That is, if the second child in a set of three fails, the third child is not executed in that iteration of the REPEAT step.
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.
When
Repeat on is set to FAILURE and an iteration fails, the pipeline is restored to its original state as it was before that iteration started. Rollback operations are performed on the first level of the pipeline only. That is, first-level variables are restored to their original values before the iteration failed, but the server does not roll back changes to any documents to which the first-level variables refer.
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. The variable you specify must be a String.
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.
To build a REPEAT step that re-executes failed steps
1. If you are inserting a REPEAT step into an existing flow service, display that service in the editor and highlight the step immediately above where you want the REPEAT step inserted.
2. Do one of the following:
Click the
button next to
on the flow service editor toolbar and click
.
Click
by the side of the flow service editor to open the Palette view. Click
and drag it to the flow service editor.
3. Complete the following fields on the Properties view:
For this property... | Specify... |
Comments | An optional descriptive comment for this step. |
Scope | The name of a document (IData object) in the pipeline to which you want to restrict this step. If you want this step to have access to the entire pipeline, leave this property blank. |
Timeout | Optional. Specifies the maximum number of seconds that this step should run. If this time elapses before the step completes, Integration Server issues a FlowTimeoutException and execution continues with the next step in the service. If you want to use the value of a pipeline variable for this property, type the variable name between % symbols. For example, %expiration%. The variable you specify must be a String. If you do not need to specify a time-out period, leave Timeout blank. For more information about how Integration Server handles flow step timeouts, refer to the description of the watt.server.threadKill.timeout.enabled configuration parameter in webMethods Integration Server Administrator’s Guide. |
Label | An optional name for this specific REPEAT step, or a null, unmatched, or empty string ($null, $default, blank). Important:
If you use this step as a target for a BRANCH or EXIT step, you must specify a value in the Label property. For more information about the BRANCH and EXIT steps, see
The BRANCH Step or
The EXIT Step. |
Count | The maximum number of times you want the children to be re-executed. If you want to use the value of a pipeline variable for this property, type the variable name between % symbols (for example, %servicecount%). The variable you specify must be a String. If you want the children re-executed until they are all successful (that is, no maximum limit), set this value to –1. |
Repeat interval | The length of time (in seconds) that you want the server to wait between iterations of the children. If you want to use the value of a pipeline variable for this property, type the variable name between % symbols (for example, %waittime%). The variable you specify must be a String. |
Repeat on | FAILURE |
4. Beneath the REPEAT step, use the following steps to insert each step that you want to repeat:
a. Insert a flow step using the buttons on the flow service editor toolbar.
b. Indent that flow step using on the flow service editor toolbar. (Make it a child of the REPEAT step.) c. Set the properties for the child step as needed.
5. Click File > Save.