RetryStrategyOptions
Configures the retry resilience strategy.Properties
The maximum number of retries to use, in addition to the original call.
- Must be between 1 and
int.MaxValue - Use
int.MaxValueto retry indefinitely
The type of back-off strategy to use between retries.Supported values:
Constant: Fixed delay between retriesLinear: Delay increases linearlyExponential: Delay increases exponentially
DelayGenerator is set.Indicates whether jitter should be used when calculating the backoff delay.Jitter helps prevent correlated retries and can improve overall resilience.
The base delay between retries.
- For
Exponential: Represents the median delay before the first retry - For
Linear: Represents the initial delay, increasing linearly - For
Constant: Represents the fixed delay between retries
DelayGenerator returns a valid TimeSpan.The maximum delay between retries.Used to cap the maximum delay, especially useful with exponential backoff. If
null, the delay is not capped.A predicate that determines whether the retry should be executed for a given outcome.Default: Retries on any exception except
OperationCanceledException.A generator that calculates the delay between retries.If the generator returns
null, the delay calculated by the retry strategy will be used.An event delegate that is raised when a retry happens.Important: After this event, the result is discarded and disposed. Create a copy if you need to preserve it.
Extension Methods
Add retry strategies to a resilience pipeline using these extension methods:OnRetryArguments
Arguments passed to theOnRetry callback.