Retry
AutomatR.DefaultActivities.Retry
The "Retry" activity in AutomatR is a specialized control flow activity that allows you to automatically retry a sequence of activities until a specified condition is met or a maximum number of attempts is reached. This activity is useful for handling transient errors or situations where you want to retry an operation until it succeeds.
Properties
Name | Description |
---|---|
Misc | |
Condition | Specifies the condition that, when true, indicates that the activities have succeeded, and the retry loop should exit. The activities inside the "Retry Scope" will be re-executed until this condition is met or the maximum number of attempts is reached. Boolean variables or expressions that result in a boolean value. The condition determines whether the retry loop continues or exits. |
Display Name | The display name of the activity. A display name is automatically generated when you indicate a target. |
Max Attempts | Specifies the maximum number of attempts to execute the activities inside the "Retry Scope." If the condition is not met within the specified number of attempts, the retry loop exits. Integer variables representing the maximum number of attempts. |
Retry Interval | Specifies the time interval (in milliseconds) between consecutive attempts. This property allows you to control the timing between retries to avoid overwhelming the system or API being accessed. Integer variables representing the retry interval in milliseconds. |
How to use:
- Drag and drop the "Retry" activity onto the workflow.
- In the "Condition" property, define the condition that, when true, indicates that the activities have succeeded.
- In the "Max Attempts" property, specify the maximum number of attempts for the retry loop.
- In the "Retry Interval" property, define the time interval between consecutive attempts.
- Place the activities to be retried inside the "Retry Scope" container.
Example: Consider an example where the "Retry" activity is used to retry reading a file until it succeeds or reaches a maximum number of attempts:
Retry:
Display Name: "Retry Read File"
Condition: File.Exists("example.txt")
Max Attempts: 3
Retry Interval: 1000 // 1 second
Retry Scope:
Read Text File: "example.txt"
In this example, the "Retry" activity retries reading the file "example.txt" until the condition (File.Exists("example.txt")) is true or until the maximum number of attempts (3) is reached. The "Retry Interval" is set to 1 second between attempts.
The "Retry" activity is a powerful tool for handling transient errors and automating scenarios where you want to give an operation multiple chances to succeed. It provides robust error-handling capabilities in automation workflows.