Struct RetryEvent

Namespace
Kevlar
Assembly
Kevlar.dll

Describes a retry that is about to happen.

public readonly struct RetryEvent
Inherited Members

Properties

AttemptNumber

The zero-based retry attempt number (0 = first retry after the initial execution).

public int AttemptNumber { get; }

Property Value

int

Context

The ambient execution context. It is pooled; do not retain it or its property bag after the callback (including an asynchronous callback) completes.

public KevlarContext Context { get; }

Property Value

KevlarContext

Delay

The delay that will be waited before the retry.

public TimeSpan Delay { get; }

Property Value

TimeSpan

Exception

The exception from the failed attempt, or null when a result was handled.

public Exception? Exception { get; }

Property Value

Exception

Result

The handled result from the failed attempt, or null when an exception occurred.

public object? Result { get; }

Property Value

object

Remarks

The untyped event carries the result as object, so a value-type result is boxed on every retry and has to be unboxed — and its type re-asserted — by the callback. Configure the retry through RetryOptions<TResult> on a Shield<TResult> to receive RetryEvent<TResult> instead: its Outcome is a typed Outcome<T>, with no boxing and no cast.

Methods

RequestTerminalInspection()

Requests one final delay-generator invocation when a handled outcome exhausts the retry budget. The inspection does not schedule another retry.

public void RequestTerminalInspection()

SuppressAdditionalAttempts()

Suppresses this retry and any later retry or hedge attempts in the current execution.

public void SuppressAdditionalAttempts()