RetryPolicy Class
- java.
lang. Object - com.
microsoft. durabletask. RetryPolicy
- com.
public final class RetryPolicy
A declarative retry policy that can be configured for activity or sub-orchestration calls.
Constructor Summary
| Constructor | Description |
|---|---|
| RetryPolicy(int maxNumberOfAttempts, Duration firstRetryInterval) |
Creates a new |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
| double |
getBackoffCoefficient()
Gets the configured exponential backoff coefficient used to determine the delay between subsequent retries. |
| java.time.Duration |
getFirstRetryInterval()
Gets the configured amount of time to delay between the first and second attempt. |
| int |
getMaxNumberOfAttempts()
Gets the configured maximum number of task invocation attempts. |
| java.time.Duration |
getMaxRetryInterval()
Gets the configured maximum time to delay between attempts. |
| java.time.Duration |
getRetryTimeout()
Gets the configured overall timeout for retries. |
|
Retry |
setBackoffCoefficient(double backoffCoefficient)
Sets the exponential backoff coefficient used to determine the delay between subsequent retries. |
|
Retry |
setFirstRetryInterval(Duration firstRetryInterval)
Sets the amount of time to delay between the first and second attempt. |
|
Retry |
setMaxNumberOfAttempts(int maxNumberOfAttempts)
Sets the maximum number of task invocation attempts; must be 1 or greater. |
|
Retry |
setMaxRetryInterval(Duration maxRetryInterval)
Sets the maximum time to delay between attempts. |
|
Retry |
setRetryTimeout(Duration retryTimeout)
Sets the overall timeout for retries, regardless of the retry count. |
Methods inherited from java.lang.Object
Constructor Details
RetryPolicy
public RetryPolicy(int maxNumberOfAttempts, Duration firstRetryInterval)
Creates a new RetryPolicy object.
Parameters:
Method Details
getBackoffCoefficient
public double getBackoffCoefficient()
Gets the configured exponential backoff coefficient used to determine the delay between subsequent retries.
Returns:
getFirstRetryInterval
public Duration getFirstRetryInterval()
Gets the configured amount of time to delay between the first and second attempt.
Returns:
getMaxNumberOfAttempts
public int getMaxNumberOfAttempts()
Gets the configured maximum number of task invocation attempts.
Returns:
getMaxRetryInterval
public Duration getMaxRetryInterval()
Gets the configured maximum time to delay between attempts.
Returns:
getRetryTimeout
public Duration getRetryTimeout()
Gets the configured overall timeout for retries.
Returns:
setBackoffCoefficient
public RetryPolicy setBackoffCoefficient(double backoffCoefficient)
Sets the exponential backoff coefficient used to determine the delay between subsequent retries. Must be 1.0 or greater.
To avoid extremely long delays between retries, consider also specifying a maximum retry interval using the #setMaxRetryInterval method.
Parameters:
Returns:
setFirstRetryInterval
public RetryPolicy setFirstRetryInterval(Duration firstRetryInterval)
Sets the amount of time to delay between the first and second attempt.
Parameters:
Returns:
setMaxNumberOfAttempts
public RetryPolicy setMaxNumberOfAttempts(int maxNumberOfAttempts)
Sets the maximum number of task invocation attempts; must be 1 or greater.
This value represents the number of times to attempt to execute the task. It does not represent the maximum number of times to retry the task. This is why the number must be 1 or greater.
Parameters:
Returns:
setMaxRetryInterval
public RetryPolicy setMaxRetryInterval(Duration maxRetryInterval)
Sets the maximum time to delay between attempts.
It's recommended to set a maximum retry interval whenever using a backoff coefficient that's greater than the default of 1.0.
Parameters:
null to remove the maximum retry
interval
Returns:
setRetryTimeout
public RetryPolicy setRetryTimeout(Duration retryTimeout)
Sets the overall timeout for retries, regardless of the retry count.
Parameters:
Returns: