Class PipelineRetryPolicy<T>
Defines retry behavior for transient failures in segments or destinations.
public sealed class PipelineRetryPolicy<T> where T : PipelineRecord
Type Parameters
TThe pipeline record type processed by the policy.
- Inheritance
-
PipelineRetryPolicy<T>
- Inherited Members
Properties
DelayProvider
Gets the delegate used to calculate delay before the next attempt.
public Func<PipelineRetryContext<T>, TimeSpan> DelayProvider { get; }
Property Value
MaxAttempts
Gets the maximum number of attempts allowed by the policy.
public int MaxAttempts { get; }
Property Value
Methods
ExponentialBackoff(int, TimeSpan, TimeSpan, bool)
Creates an exponential backoff retry policy.
public static PipelineRetryPolicy<T> ExponentialBackoff(int maxAttempts, TimeSpan initialDelay, TimeSpan maxDelay, bool useJitter = false)
Parameters
maxAttemptsintThe total number of attempts, including the initial attempt.
initialDelayTimeSpanThe delay used before the first retry attempt.
maxDelayTimeSpanThe maximum delay allowed between attempts.
useJitterboolA value indicating whether randomized jitter should be applied.
Returns
- PipelineRetryPolicy<T>
An exponential backoff retry policy.
FixedDelay(int, TimeSpan)
Creates a fixed-delay retry policy.
public static PipelineRetryPolicy<T> FixedDelay(int maxAttempts, TimeSpan delay)
Parameters
maxAttemptsintThe total number of attempts, including the initial attempt.
delayTimeSpanThe delay applied between attempts.
Returns
- PipelineRetryPolicy<T>
A fixed-delay retry policy.
Handle(Func<PipelineRetryContext<T>, bool>)
Restricts retries using a custom predicate.
public PipelineRetryPolicy<T> Handle(Func<PipelineRetryContext<T>, bool> predicate)
Parameters
predicateFunc<PipelineRetryContext<T>, bool>The predicate used to determine whether a retry is allowed.
Returns
- PipelineRetryPolicy<T>
A new retry policy with the additional filter applied.
Handle<TException>()
Restricts retries to exceptions of the specified type.
public PipelineRetryPolicy<T> Handle<TException>() where TException : Exception
Returns
- PipelineRetryPolicy<T>
A new retry policy with the additional filter applied.
Type Parameters
TExceptionThe exception type that should be retried.
None()
Creates a policy that performs no retries beyond the initial attempt.
public static PipelineRetryPolicy<T> None()
Returns
- PipelineRetryPolicy<T>
A retry policy with no retry behavior.