Referencia Pública de API .NETL2 Transversal y FiabilidadEstableAOT: Completo

EricksonLopez.Resilience

Enterprise-grade Clean Architecture resilience & fault-tolerance framework for modern .NET (8/9/10). Native AOT-compatible, Polly v8 isolation, Result (ROP) error classification, and OpenTelemetry observability.

24 namespaces73 tipos343 miembrosGenerado desde XML docs y ensamblados · UTC 2026-12-01

Mostrando 73 de 73 tipos (343 miembros)

EricksonLopez.Resilience#

8
interface

IResilienceExecutor

Ensamblado: EricksonLopez.Resilience.Abstractions
public interface IResilienceExecutor

Defines the primary resilience execution facade for the EricksonLopez ecosystem.

Notas:

Application services and handlers inject this abstraction to execute operations under declared, named resilience policies without depending directly on concrete execution engines or infrastructure implementations.

Miembros (4)

  • methodExecuteAsync
    ValueTask ExecuteAsync(string policyName, Func<CancellationToken, ValueTask> operation, CancellationToken cancellationToken = default)

    Executes an asynchronous action without a return value under the specified resilience policy.

    policyName: string
    The name of the registered resilience policy to apply.
    operation: Func<CancellationToken, ValueTask>
    The asynchronous action accepting a cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation.

    Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; Exceptions.ResiliencePolicyNotFoundException: No policy was registered under the specified `policyName`; ArgumentNullException: `operation` is `null`; ArgumentException: `policyName` is `null` or whitespace

  • methodExecuteAsync
    ValueTask ExecuteAsync(string policyName, Func<ResilienceContext, ValueTask> operation, ResilienceContext context, CancellationToken cancellationToken = default)

    Executes an asynchronous action without a return value under the specified resilience policy using an explicit context.

    policyName: string
    The name of the registered resilience policy to apply.
    operation: Func<ResilienceContext, ValueTask>
    The asynchronous action accepting the execution context.
    context: ResilienceContext
    The resilience context containing metadata and telemetry context.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation.

    Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; Exceptions.ResiliencePolicyNotFoundException: No policy was registered under the specified `policyName`; ArgumentNullException: `operation` or `context` is `null`; ArgumentException: `policyName` is `null` or whitespace

  • methodExecuteAsync<TResult>
    ValueTask<TResult> ExecuteAsync<TResult>(string policyName, Func<CancellationToken, ValueTask<TResult>> operation, CancellationToken cancellationToken = default)

    Executes an asynchronous operation that yields a value under the specified resilience policy.

    policyName: string
    The name of the registered resilience policy to apply.
    operation: Func<CancellationToken, ValueTask<TResult>>
    The asynchronous operation accepting a cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation. The task result contains the value produced by `operation`.

    Type parameters: TResult: The return type of the operation. Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; Exceptions.ResiliencePolicyNotFoundException: No policy was registered under the specified `policyName`; ArgumentNullException: `operation` is `null`; ArgumentException: `policyName` is `null` or whitespace

  • methodExecuteAsync<TResult>
    ValueTask<TResult> ExecuteAsync<TResult>(string policyName, Func<ResilienceContext, ValueTask<TResult>> operation, ResilienceContext context, CancellationToken cancellationToken = default)

    Executes an asynchronous operation that yields a value under the specified resilience policy using an explicit context.

    policyName: string
    The name of the registered resilience policy to apply.
    operation: Func<ResilienceContext, ValueTask<TResult>>
    The asynchronous operation accepting the execution context.
    context: ResilienceContext
    The resilience context containing metadata and telemetry context.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation. The task result contains the value produced by `operation`.

    Type parameters: TResult: The return type of the operation. Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; Exceptions.ResiliencePolicyNotFoundException: No policy was registered under the specified `policyName`; ArgumentNullException: `operation` or `context` is `null`; ArgumentException: `policyName` is `null` or whitespace

interface

IResiliencePipeline

Ensamblado: EricksonLopez.Resilience.Abstractions
public interface IResiliencePipeline : IDisposable, IAsyncDisposable
Implementa: IAsyncDisposable, IDisposable

Defines a resilience execution pipeline capable of executing asynchronous delegates with fault-tolerance strategies and managing the deterministic lifecycle disposal of underlying strategy resources.

Miembros (4)

  • methodExecuteAsync
    ValueTask ExecuteAsync(Func<CancellationToken, ValueTask> operation, CancellationToken cancellationToken = default)

    Executes an asynchronous action without a return value within this resilience pipeline.

    operation: Func<CancellationToken, ValueTask>
    The asynchronous action accepting a cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation.

    Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` is `null`

  • methodExecuteAsync
    ValueTask ExecuteAsync(Func<ResilienceContext, ValueTask> operation, ResilienceContext context, CancellationToken cancellationToken = default)

    Executes an asynchronous action without a return value within this resilience pipeline using the specified context.

    operation: Func<ResilienceContext, ValueTask>
    The asynchronous action to execute.
    context: ResilienceContext
    The resilience context carrying execution metadata and cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation.

    Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` or `context` is `null`

  • methodExecuteAsync<TResult>
    ValueTask<TResult> ExecuteAsync<TResult>(Func<CancellationToken, ValueTask<TResult>> operation, CancellationToken cancellationToken = default)

    Executes an asynchronous operation that returns a value within this resilience pipeline.

    operation: Func<CancellationToken, ValueTask<TResult>>
    The asynchronous operation accepting a cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation. The task result contains the value produced by `operation`.

    Type parameters: TResult: The return type of the operation. Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` is `null`

  • methodExecuteAsync<TResult>
    ValueTask<TResult> ExecuteAsync<TResult>(Func<ResilienceContext, ValueTask<TResult>> operation, ResilienceContext context, CancellationToken cancellationToken = default)

    Executes an asynchronous operation that returns a value within this resilience pipeline using the specified context.

    operation: Func<ResilienceContext, ValueTask<TResult>>
    The asynchronous operation to execute.
    context: ResilienceContext
    The resilience context carrying execution metadata and cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation. The task result contains the value produced by `operation`.

    Type parameters: TResult: The return type of the operation. Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` or `context` is `null`

interface

IResiliencePipelineBuilder

Ensamblado: EricksonLopez.Resilience.Abstractions
public interface IResiliencePipelineBuilder

Defines a builder for configuring and assembling resilience strategies into an executable pipeline.

Miembros (13)

  • methodAddCircuitBreaker
    IResiliencePipelineBuilder AddCircuitBreaker(Action<CircuitBreakerStrategyOptions> configure)

    Adds a circuit breaker strategy to the pipeline configured via an action delegate.

    configure: Action<CircuitBreakerStrategyOptions>
    The configuration delegate.

    Retorna: The builder instance for fluent chaining.

  • methodAddCircuitBreaker
    IResiliencePipelineBuilder AddCircuitBreaker(CircuitBreakerStrategyOptions options)

    Adds a circuit breaker strategy to the pipeline.

    options: CircuitBreakerStrategyOptions
    The circuit breaker strategy options.

    Retorna: The builder instance for fluent chaining.

  • methodAddHedging
    IResiliencePipelineBuilder AddHedging(Action<HedgingStrategyOptions> configure)

    Adds a hedging strategy to the pipeline configured via an action delegate.

    configure: Action<HedgingStrategyOptions>
    The configuration delegate.

    Retorna: The builder instance for fluent chaining.

    Untyped hedging cannot perform concurrent speculative executions in Polly v8 and falls back to sequential retry. Use `ResiliencePipelineBuilder<TResult>.AddHedging` instead for parallel hedging.

  • methodAddHedging
    IResiliencePipelineBuilder AddHedging(HedgingStrategyOptions options)

    Adds a hedging strategy to the pipeline.

    options: HedgingStrategyOptions
    The hedging strategy options.

    Retorna: The builder instance for fluent chaining.

    Untyped hedging cannot perform concurrent speculative executions in Polly v8 and falls back to sequential retry. Use `ResiliencePipelineBuilder<TResult>.AddHedging` instead for parallel hedging.

  • methodAddRateLimiter
    IResiliencePipelineBuilder AddRateLimiter(Action<RateLimiterStrategyOptions> configure)

    Adds a rate limiter strategy to the pipeline configured via an action delegate.

    configure: Action<RateLimiterStrategyOptions>
    The configuration delegate.

    Retorna: The builder instance for fluent chaining.

  • methodAddRateLimiter
    IResiliencePipelineBuilder AddRateLimiter(RateLimiterStrategyOptions options)

    Adds a rate limiter strategy to the pipeline.

    options: RateLimiterStrategyOptions
    The rate limiter strategy options.

    Retorna: The builder instance for fluent chaining.

  • methodAddRetry
    IResiliencePipelineBuilder AddRetry(Action<RetryStrategyOptions> configure)

    Adds a retry strategy to the pipeline configured via an action delegate.

    configure: Action<RetryStrategyOptions>
    The configuration delegate.

    Retorna: The builder instance for fluent chaining.

  • methodAddRetry
    IResiliencePipelineBuilder AddRetry(RetryStrategyOptions options)

    Adds a retry strategy to the pipeline.

    options: RetryStrategyOptions
    The retry strategy options.

    Retorna: The builder instance for fluent chaining.

  • methodAddTimeout
    IResiliencePipelineBuilder AddTimeout(Action<TimeoutStrategyOptions> configure)

    Adds a timeout strategy to the pipeline configured via an action delegate.

    configure: Action<TimeoutStrategyOptions>
    The configuration delegate.

    Retorna: The builder instance for fluent chaining.

  • methodAddTimeout
    IResiliencePipelineBuilder AddTimeout(TimeoutStrategyOptions options)

    Adds a timeout strategy to the pipeline.

    options: TimeoutStrategyOptions
    The timeout strategy options.

    Retorna: The builder instance for fluent chaining.

  • methodBuild
    IResiliencePipeline Build()

    Builds and returns the compiled `IResiliencePipeline`.

    Retorna: The compiled resilience pipeline.

  • propertyName
    string Name { get; }

    Gets the unique name of the pipeline being built.

  • propertyStrategies
    IReadOnlyList<ResilienceStrategyOptions> Strategies { get; }

    Gets the collection of configured strategy options in order of addition.

interface

IResiliencePipelineRegistry

Ensamblado: EricksonLopez.Resilience.Abstractions
public interface IResiliencePipelineRegistry : IDisposable, IAsyncDisposable
Implementa: IAsyncDisposable, IDisposable

Defines a registry for storing and retrieving configured resilience pipelines by their unique names.

Miembros (4)

  • methodGetPipeline
    IResiliencePipeline GetPipeline(string policyName)

    Retrieves a compiled resilience pipeline associated with the specified policy name.

    policyName: string
    The unique name of the policy.

    Retorna: The resolved `IResiliencePipeline` instance.

    Exceptions: Exceptions.ResiliencePolicyNotFoundException: No pipeline is registered under the specified policy name

  • methodGetPipeline<TResult>
    IResiliencePipeline<TResult> GetPipeline<TResult>(string policyName)

    Retrieves a typed resilience pipeline associated with the specified policy name.

    policyName: string
    The unique name of the policy.

    Retorna: The resolved `IResiliencePipeline<TResult>` instance.

    Type parameters: TResult: The expected result type of the pipeline. Exceptions: Exceptions.ResiliencePolicyNotFoundException: No typed pipeline is registered under the specified policy name

  • methodTryGetPipeline
    bool TryGetPipeline(string policyName, out IResiliencePipeline? pipeline)

    Attempts to retrieve a compiled resilience pipeline associated with the specified policy name.

    policyName: string
    The unique name of the policy.
    pipeline: out IResiliencePipeline?
    When this method returns, contains the pipeline if found; otherwise, `null`.

    Retorna: `true` if the pipeline exists; otherwise, `false`.

  • methodTryGetPipeline<TResult>
    bool TryGetPipeline<TResult>(string policyName, out IResiliencePipeline<TResult>? pipeline)

    Attempts to retrieve a typed resilience pipeline associated with the specified policy name.

    policyName: string
    The unique name of the policy.
    pipeline: out IResiliencePipeline<TResult>?
    When this method returns, contains the typed pipeline if found; otherwise, `null`.

    Retorna: `true` if the typed pipeline exists; otherwise, `false`.

    Type parameters: TResult: The expected result type of the pipeline.

interface

IResiliencePipeline<TResult>

Ensamblado: EricksonLopez.Resilience.Abstractions
public interface IResiliencePipeline<TResult> : IDisposable, IAsyncDisposable
Implementa: IAsyncDisposable, IDisposable

Defines a strongly-typed resilience execution pipeline capable of executing asynchronous delegates returning `TResult` with fault-tolerance strategies and managing the deterministic lifecycle disposal of underlying strategy resources.

Notas:

Type parameters: TResult: The type of value returned by operations executed in this pipeline.

Miembros (2)

  • methodExecuteAsync
    ValueTask<TResult> ExecuteAsync(Func<CancellationToken, ValueTask<TResult>> operation, CancellationToken cancellationToken = default)

    Executes a typed asynchronous operation within this resilience pipeline.

    operation: Func<CancellationToken, ValueTask<TResult>>
    The asynchronous operation accepting a cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation. The task result contains the value produced by `operation`.

    Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` is `null`

  • methodExecuteAsync
    ValueTask<TResult> ExecuteAsync(Func<ResilienceContext, ValueTask<TResult>> operation, ResilienceContext context, CancellationToken cancellationToken = default)

    Executes a typed asynchronous operation within this resilience pipeline using the specified context.

    operation: Func<ResilienceContext, ValueTask<TResult>>
    The asynchronous operation to execute.
    context: ResilienceContext
    The resilience context carrying execution metadata and cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation. The task result contains the value produced by `operation`.

    Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` or `context` is `null`

class

ResilienceContext

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class ResilienceContext

Represents the execution context for a resilient operation within the EricksonLopez ecosystem.

Notas:

Encapsulates execution metadata including policy identification, operation naming, correlation tracking, tenant isolation, and attempt tracking without introducing static or mutable ambient state. The identity properties `PolicyName`, `OperationName`, `CorrelationId`, `TenantId`, and `CancellationToken` are set at construction and are immutable for the lifetime of the context instance. `SetProperty` mutates the internal properties dictionary thread-safely in-place. `AttemptNumber` is an immutable attempt index: it defaults to 1 and can be updated thread-safely via `WithAttemptNumber(int)` to obtain an attempt-scoped copy-on-write snapshot.

Miembros (19)

  • constructorResilienceContext
    public ResilienceContext(string policyName, string? operationName = null, string? correlationId = null, string? tenantId = null, CancellationToken cancellationToken = default)

    Initializes a new instance of the `ResilienceContext` class with default initial attempt index (1).

    policyName: string
    The unique identifier of the resilience policy.
    operationName: string?
    The optional human-readable name of the executing operation.
    correlationId: string?
    The optional correlation identifier for distributed tracing.
    tenantId: string?
    The optional tenant identifier for multi-tenant isolation.
    cancellationToken: CancellationToken
    The cancellation token associated with the execution.

    Exceptions: ArgumentException: `policyName` is `null` or whitespace

  • constructorResilienceContext
    public ResilienceContext(string policyName, string? operationName, string? correlationId, string? tenantId, int attemptNumber, CancellationToken cancellationToken = default)

    Initializes a new instance of the `ResilienceContext` class with an explicit attempt index.

    policyName: string
    The unique identifier of the resilience policy.
    operationName: string?
    The optional human-readable name of the executing operation.
    correlationId: string?
    The optional correlation identifier for distributed tracing.
    tenantId: string?
    The optional tenant identifier for multi-tenant isolation.
    attemptNumber: int
    The 1-based attempt index for this execution context.
    cancellationToken: CancellationToken
    The cancellation token associated with the execution.

    Exceptions: ArgumentException: `policyName` is `null` or whitespace; ArgumentOutOfRangeException: `attemptNumber` is less than 0

  • methodCopyPropertiesTo
    public void CopyPropertiesTo(ResilienceContext destination)

    Copies all custom properties from this context to the specified destination context.

    destination: ResilienceContext
    The destination context.

    Exceptions: ArgumentNullException: `destination` is `null`

  • methodCreate
    public static ResilienceContext Create(string policyName, CancellationToken cancellationToken = default)

    Creates a default empty context for a given policy name and cancellation token.

    policyName: string
    The name of the resilience policy.
    cancellationToken: CancellationToken
    The cancellation token.

    Retorna: A new `ResilienceContext` instance.

  • methodCreate
    public static ResilienceContext Create(string policyName, int attemptNumber, CancellationToken cancellationToken = default)

    Creates a default empty context for a given policy name, initial attempt number, and optional cancellation token.

    policyName: string
    The name of the resilience policy.
    attemptNumber: int
    The initial attempt index.
    cancellationToken: CancellationToken
    The cancellation token.

    Retorna: A new `ResilienceContext` instance.

  • methodSetProperty
    public ResilienceContext SetProperty(string key, object? value)

    Sets a custom property value in the execution context.

    key: string
    The property key.
    value: object?
    The property value.

    Retorna: The current context instance for method chaining.

    Exceptions: ArgumentException: `key` is `null` or whitespace

  • methodTryGetProperty<T>
    public bool TryGetProperty<T>(string key, out T? value)

    Attempts to retrieve a strongly-typed property value from the execution context.

    key: string
    The property key.
    value: out T?
    When this method returns, contains the property value if found and of type `T`; otherwise, the default value.

    Retorna: `true` if the property exists and matches the specified type; otherwise, `false`.

    Type parameters: T: The expected type of the property value. Exceptions: ArgumentException: `key` is `null` or whitespace

  • methodWithAttemptNumber
    public ResilienceContext WithAttemptNumber(int attemptNumber)

    Creates a new `ResilienceContext` instance with the specified attempt number.

    attemptNumber: int
    The attempt number.

    Retorna: A new context instance with the updated attempt number.

  • methodWithCancellationToken
    public ResilienceContext WithCancellationToken(CancellationToken cancellationToken)

    Creates a new `ResilienceContext` instance with the specified cancellation token while preserving all metadata and properties.

    cancellationToken: CancellationToken
    The new cancellation token.

    Retorna: A new context instance with the updated cancellation token.

  • methodWithCorrelationId
    public ResilienceContext WithCorrelationId(string correlationId)

    Creates a new `ResilienceContext` instance with the specified correlation identifier.

    correlationId: string
    The correlation identifier.

    Retorna: A new context instance with the updated correlation identifier.

  • methodWithOperationName
    public ResilienceContext WithOperationName(string operationName)

    Creates a new `ResilienceContext` instance with the specified operation name.

    operationName: string
    The operation name.

    Retorna: A new context instance with the updated operation name.

  • methodWithTenantId
    public ResilienceContext WithTenantId(string tenantId)

    Creates a new `ResilienceContext` instance with the specified tenant identifier.

    tenantId: string
    The tenant identifier.

    Retorna: A new context instance with the updated tenant identifier.

  • propertyAttemptNumber
    public int AttemptNumber { get; init; }

    Gets the current execution attempt index (1-based).

    `AttemptNumber` is immutable for the lifetime of this context instance, defaulting to `1`. To produce a context with an updated attempt index without mutating shared state or introducing data races across parallel speculative attempts (e.g. hedging), call `WithAttemptNumber(int)`.

  • propertyCancellationToken
    public CancellationToken CancellationToken { get; }

    Gets the cancellation token governing this execution.

  • propertyCorrelationId
    public string? CorrelationId { get; }

    Gets the correlation identifier for distributed tracing and logging.

  • propertyOperationName
    public string OperationName { get; }

    Gets the human-readable name of the executing operation.

  • propertyPolicyName
    public string PolicyName { get; }

    Gets the unique name of the resilience policy.

  • propertyProperties
    public IReadOnlyDictionary<string, object?> Properties { get; }

    Gets a read-only view of custom context properties.

  • propertyTenantId
    public string? TenantId { get; }

    Gets the tenant identifier for multi-tenant partition and isolation.

class

ResilienceExecutionContextScope

Ensamblado: EricksonLopez.Resilience.Abstractions
public static class ResilienceExecutionContextScope

Provides an ambient execution context scope that bridges `CancellationToken` instances across asynchronous execution boundaries where interface signatures cannot directly pass a cancellation token.

Notas:

Under high-concurrency pipeline execution, strategies such as timeouts or hedge deadlines cancel tokens deep within inner scopes. This ambient bridge enables downstream handlers, database interceptors, and pipeline behaviors to observe token cancellation without altering existing zero-allocation parameterless signatures.

Miembros (4)

  • methodGetCurrentOrDefault
    public static CancellationToken GetCurrentOrDefault(CancellationToken fallback = default)

    Gets the current ambient `CancellationToken` if one is active and can be canceled; otherwise returns the specified `fallback` token.

    fallback: CancellationToken
    The fallback token to return if no ambient token is active.

    Retorna: The active ambient token or `fallback`.

  • methodSetCurrentToken
    public static TokenScope SetCurrentToken(CancellationToken token)

    Sets the ambient cancellation token for the current asynchronous execution context.

    token: CancellationToken
    The cancellation token to set as ambient.

    Retorna: A zero-allocation `TokenScope` struct that restores the previous ambient token upon disposal.

  • propertyCurrentToken
    public static CancellationToken CurrentToken { get; }

    Gets the ambient `CancellationToken` associated with the current asynchronous execution context. If no scope is active, returns `CancellationToken.None`.

  • propertyHasCurrentToken
    public static bool HasCurrentToken { get; }

    Gets a value indicating whether an ambient cancellation token is active and capable of being canceled.

struct

ResilienceExecutionContextScope.TokenScope

Ensamblado: EricksonLopez.Resilience.Abstractions
public readonly struct TokenScope : IDisposable, IEquatable<TokenScope>
Implementa: IDisposable, IEquatable<TokenScope>

Manages the lifetime of an ambient cancellation token scope as a lightweight stack-allocated struct. Restores the previous ambient token when disposed without allocating heap memory.

Miembros (6)

  • methodDispose
    public void Dispose()

    Restores the previous ambient `CancellationToken` associated with this execution context.

  • methodEquals
    public override bool Equals(object? obj)

    Inherits documentation from base type or interface.

    obj: object?
  • methodEquals
    public bool Equals(TokenScope other)

    Inherits documentation from base type or interface.

    other: TokenScope
  • methodGetHashCode
    public override int GetHashCode()

    Inherits documentation from base type or interface.

  • methodoperator !=
    public static bool operator !=(TokenScope left, TokenScope right)

    Compares two `TokenScope` instances for inequality.

    left: TokenScope
    right: TokenScope
  • methodoperator ==
    public static bool operator ==(TokenScope left, TokenScope right)

    Compares two `TokenScope` instances for equality.

    left: TokenScope
    right: TokenScope

EricksonLopez.Resilience.AspNetCore.Extensions#

3
class

AspNetCoreResilienceExtensions

Ensamblado: EricksonLopez.Resilience.AspNetCore
public static class AspNetCoreResilienceExtensions

Provides extension methods for attaching resilience metadata and filters to ASP.NET Core endpoint builders and applications.

Miembros (3)

  • methodRequireResilience
    public static RouteHandlerBuilder RequireResilience(this RouteHandlerBuilder builder, string policyName)

    Attaches resilience policy metadata and registers `ResilienceEndpointFilter` on the route handler builder.

    builder: this RouteHandlerBuilder
    The route handler builder.
    policyName: string
    The name of the resilience policy.

    Retorna: The builder instance for method chaining.

    Exceptions: ArgumentNullException: `builder` is `null`; ArgumentException: `policyName` is `null` or whitespace

  • methodRequireResilience<TBuilder>
    public static TBuilder RequireResilience<TBuilder>(this TBuilder builder, string policyName) where TBuilder : IEndpointConventionBuilder

    Attaches resilience policy metadata to the endpoint convention builder.

    builder: this TBuilder
    The endpoint builder.
    policyName: string
    The name of the resilience policy.

    Retorna: The builder instance for method chaining.

    Type parameters: TBuilder: The type of the endpoint convention builder. Exceptions: ArgumentNullException: `builder` is `null`; ArgumentException: `policyName` is `null` or whitespace

  • methodUseResilience
    public static IApplicationBuilder UseResilience(this IApplicationBuilder app)

    Adds `ResilienceMiddleware` to the application request execution pipeline.

    app: this IApplicationBuilder
    The application builder.

    Retorna: The application builder for method chaining.

    Exceptions: ArgumentNullException: `app` is `null`

class

CircuitBreakerHealthCheckExtensions

Ensamblado: EricksonLopez.Resilience.AspNetCore
public static class CircuitBreakerHealthCheckExtensions

Provides extension methods for registering resilience circuit breaker health checks in ASP.NET Core applications.

Miembros (1)

  • methodAddCircuitBreakerCheck
    public static IHealthChecksBuilder AddCircuitBreakerCheck(this IHealthChecksBuilder builder, string name, string policyName, Func<CircuitBreakerState> stateAccessor, HealthStatus? failureStatus = null, IEnumerable<string>? tags = null)

    Adds a resilience circuit breaker health check to the health check builder.

    builder: this IHealthChecksBuilder
    The health check builder.
    name: string
    The health check name.
    policyName: string
    The policy name.
    stateAccessor: Func<CircuitBreakerState>
    A delegate that retrieves the current circuit breaker state.
    failureStatus: HealthStatus?
    The failure status to report when the circuit is open.
    tags: IEnumerable<string>?
    Optional tags for the health check.

    Retorna: The health check builder for method chaining.

    Exceptions: ArgumentNullException: `builder` or `stateAccessor` is `null`; ArgumentException: `name` or `policyName` is `null` or whitespace

class

HttpClientResilienceExtensions

Ensamblado: EricksonLopez.Resilience.AspNetCore
public static class HttpClientResilienceExtensions

Provides extension methods for configuring resilience policies on named and typed `Http.HttpClient` instances.

Miembros (3)

  • methodAddResiliencePolicy
    public static IHttpClientBuilder AddResiliencePolicy(this IHttpClientBuilder builder, string policyName)

    Adds a `ResilienceDelegatingHandler` configured with the specified policy name to the HTTP client pipeline.

    builder: this IHttpClientBuilder
    The HTTP client builder.
    policyName: string
    The name of the registered resilience policy to apply.

    Retorna: The HTTP client builder for method chaining.

    Exceptions: ArgumentNullException: `builder` is `null`; ArgumentException: `policyName` is `null` or whitespace

  • methodAddResiliencePolicy
    public static IHttpClientBuilder AddResiliencePolicy(this IHttpClientBuilder builder, string policyName, Action<ResilienceDelegatingHandlerOptions>? configureOptions)

    Adds a `ResilienceDelegatingHandler` configured with the specified policy name and options to the HTTP client pipeline.

    builder: this IHttpClientBuilder
    The HTTP client builder.
    policyName: string
    The name of the registered resilience policy to apply.
    configureOptions: Action<ResilienceDelegatingHandlerOptions>?
    An optional delegate to configure `ResilienceDelegatingHandlerOptions`.

    Retorna: The HTTP client builder for method chaining.

    Exceptions: ArgumentNullException: `builder` is `null`; ArgumentException: `policyName` is `null` or whitespace

  • methodAddStandardResilienceHandler
    public static IHttpClientBuilder AddStandardResilienceHandler(this IHttpClientBuilder builder, string? policyName = null, Action<IResiliencePipelineBuilder>? configure = null)

    Adds a standard comprehensive resilience pipeline to the HTTP client comprising total timeout, retry with exponential jitter, circuit breaker, and rate limiting.

    builder: this IHttpClientBuilder
    The HTTP client builder.
    policyName: string?
    The optional custom policy name. If omitted, defaults to a name derived from the client.
    configure: Action<IResiliencePipelineBuilder>?
    An optional delegate to customize the standard HTTP resilience pipeline.

    Retorna: The HTTP client builder for method chaining.

    Exceptions: ArgumentNullException: `builder` is `null`

EricksonLopez.Resilience.AspNetCore.Filters#

1
class

ResilienceEndpointFilter

Ensamblado: EricksonLopez.Resilience.AspNetCore
public sealed class ResilienceEndpointFilter : IEndpointFilter
Implementa: IEndpointFilter

Executes HTTP endpoints within a configured resilience policy as an endpoint filter.

Miembros (1)

  • methodInvokeAsync
    public async ValueTask<object?> InvokeAsync(EndpointFilterInvocationContext context, EndpointFilterDelegate next)

    Inherits documentation from base type or interface.

    context: EndpointFilterInvocationContext
    next: EndpointFilterDelegate

EricksonLopez.Resilience.AspNetCore.HealthChecks#

1
class

ResilienceCircuitBreakerHealthCheck

Ensamblado: EricksonLopez.Resilience.AspNetCore
public sealed class ResilienceCircuitBreakerHealthCheck : IHealthCheck
Implementa: IHealthCheck

Provides an ASP.NET Core `IHealthCheck` implementation that monitors resilience circuit breaker states.

Miembros (2)

  • constructorResilienceCircuitBreakerHealthCheck
    public ResilienceCircuitBreakerHealthCheck(string policyName, Func<CircuitBreakerState> stateAccessor)

    Initializes a new instance of the `ResilienceCircuitBreakerHealthCheck` class.

    policyName: string
    The logical policy name.
    stateAccessor: Func<CircuitBreakerState>
    The delegate returning the current circuit breaker state.

    Exceptions: ArgumentException: `policyName` is `null` or whitespace; ArgumentNullException: `stateAccessor` is `null`

  • methodCheckHealthAsync
    public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)

    Inherits documentation from base type or interface.

    context: HealthCheckContext
    cancellationToken: CancellationToken

EricksonLopez.Resilience.AspNetCore.Http#

2
class

ResilienceDelegatingHandler

Ensamblado: EricksonLopez.Resilience.AspNetCore
public sealed class ResilienceDelegatingHandler : DelegatingHandler
Hereda de: DelegatingHandler

Represents a `DelegatingHandler` that executes outgoing HTTP requests within a named `IResilienceExecutor` policy.

Miembros (2)

  • constructorResilienceDelegatingHandler
    public ResilienceDelegatingHandler(IResilienceExecutor executor, string policyName, ResilienceDelegatingHandlerOptions? options = null)

    Initializes a new instance of the `ResilienceDelegatingHandler` class.

    executor: IResilienceExecutor
    The resilience executor.
    policyName: string
    The name of the resilience policy to apply.
    options: ResilienceDelegatingHandlerOptions?
    Optional handler configuration options.

    Exceptions: ArgumentNullException: `executor` is `null`; ArgumentException: `policyName` is `null` or whitespace

  • propertyOptions
    public ResilienceDelegatingHandlerOptions Options { get; }

    Gets the handler options.

class

ResilienceDelegatingHandlerOptions

Ensamblado: EricksonLopez.Resilience.AspNetCore
public sealed class ResilienceDelegatingHandlerOptions

Configures behavior and resource limits for `ResilienceDelegatingHandler`.

Miembros (3)

  • propertyBufferRequestContent
    public bool BufferRequestContent { get; set; }

    Gets or sets whether request buffering is enabled to allow retries. When `false`, request content is not buffered, and requests with non-replayable streams cannot be retried. Defaults to `true`.

  • propertyMaxBufferSize
    public long MaxBufferSize { get; set; }

    Gets or sets the maximum request content buffer size in bytes for retryable requests. Defaults to 10 MB. Must be non-negative.

    Exceptions: ArgumentOutOfRangeException: Value is negative

  • fieldDefaultMaxBufferSize
    public const long DefaultMaxBufferSize

    Default maximum buffer size: 10 MB (10,485,760 bytes).

EricksonLopez.Resilience.AspNetCore.Metadata#

1
class

ResilienceEndpointMetadata

Ensamblado: EricksonLopez.Resilience.AspNetCore
public sealed class ResilienceEndpointMetadata

Represents endpoint metadata identifying the resilience policy associated with an ASP.NET Core HTTP endpoint.

Miembros (3)

  • constructorResilienceEndpointMetadata
    public ResilienceEndpointMetadata(string policyName)

    Initializes a new instance of the `ResilienceEndpointMetadata` class.

    policyName: string
    The name of the resilience policy.

    Exceptions: ArgumentException: `policyName` is `null` or whitespace

  • methodToString
    public override string ToString()

    Inherits documentation from base type or interface.

  • propertyPolicyName
    public string PolicyName { get; }

    Gets the name of the resilience policy.

EricksonLopez.Resilience.AspNetCore.Middleware#

1
class

ResilienceMiddleware

Ensamblado: EricksonLopez.Resilience.AspNetCore
public sealed class ResilienceMiddleware

Middleware that intercepts HTTP requests destined for endpoints decorated with `ResilienceEndpointMetadata` and executes the request delegate through `IResilienceExecutor`.

Miembros (2)

  • constructorResilienceMiddleware
    public ResilienceMiddleware(RequestDelegate next)

    Initializes a new instance of the `ResilienceMiddleware` class.

    next: RequestDelegate
    The next middleware delegate.

    Exceptions: ArgumentNullException: `next` is `null`

  • methodInvokeAsync
    public async Task InvokeAsync(HttpContext context, IResilienceExecutor executor)

    Invokes the middleware.

    context: HttpContext
    The HTTP context.
    executor: IResilienceExecutor
    The resilience executor.

    Retorna: A task representing execution.

    Exceptions: ArgumentNullException: `context` or `executor` is `null`

EricksonLopez.Resilience.Builder#

3
interface

ITypedPipelineCompiler

Ensamblado: EricksonLopez.Resilience
public interface ITypedPipelineCompiler

Defines a compiler capable of translating any `ResiliencePipelineBuilder<TResult>` into an `IResiliencePipeline<TResult>`.

Miembros (1)

  • methodCompile<TResult>
    IResiliencePipeline<TResult> Compile<TResult>(ResiliencePipelineBuilder<TResult> builder)

    Compiles a typed resilience pipeline builder into an executable pipeline.

    builder: ResiliencePipelineBuilder<TResult>
    The typed builder to compile.

    Retorna: The compiled typed pipeline.

    Type parameters: TResult: The result type of the pipeline.

class

ResiliencePipelineBuilder

Ensamblado: EricksonLopez.Resilience
public sealed class ResiliencePipelineBuilder : IResiliencePipelineBuilder
Implementa: IResiliencePipelineBuilder

Provides a builder implementation for accumulating, configuring, and validating resilience strategies to construct an `IResiliencePipeline`.

Miembros (17)

  • constructorResiliencePipelineBuilder
    public ResiliencePipelineBuilder(string name)

    Initializes a new instance of the `ResiliencePipelineBuilder` class.

    name: string
    The unique logical name of the pipeline.

    Exceptions: ArgumentException: `name` is `null` or whitespace

  • methodAddCircuitBreaker
    public IResiliencePipelineBuilder AddCircuitBreaker(Action<CircuitBreakerStrategyOptions> configure)

    Adds a circuit breaker strategy to the pipeline.

    configure: Action<CircuitBreakerStrategyOptions>

    Retorna: The builder instance for fluent chaining.

  • methodAddCircuitBreaker
    public IResiliencePipelineBuilder AddCircuitBreaker(CircuitBreakerStrategyOptions options)

    Adds a circuit breaker strategy to the pipeline.

    options: CircuitBreakerStrategyOptions
    The circuit breaker strategy options.

    Retorna: The builder instance for fluent chaining.

  • methodAddHedging
    public IResiliencePipelineBuilder AddHedging(Action<HedgingStrategyOptions> configure)

    Adds a hedging strategy to the pipeline.

    configure: Action<HedgingStrategyOptions>

    Retorna: The builder instance for fluent chaining.

    Untyped hedging cannot perform concurrent speculative executions in Polly v8 and falls back to sequential retry. Use `ResiliencePipelineBuilder<TResult>.AddHedging(Action<HedgingStrategyOptions<TResult>>)` for parallel speculative hedging.

  • methodAddHedging
    public IResiliencePipelineBuilder AddHedging(HedgingStrategyOptions options)

    Adds a hedging strategy to the pipeline.

    options: HedgingStrategyOptions
    The hedging strategy options.

    Retorna: The builder instance for fluent chaining.

    Untyped hedging cannot perform concurrent speculative executions in Polly v8 and falls back to sequential retry. Use `ResiliencePipelineBuilder<TResult>.AddHedging(HedgingStrategyOptions<TResult>)` for parallel speculative hedging.

  • methodAddRateLimiter
    public IResiliencePipelineBuilder AddRateLimiter(Action<RateLimiterStrategyOptions> configure)

    Adds a rate limiter strategy to the pipeline.

    configure: Action<RateLimiterStrategyOptions>

    Retorna: The builder instance for fluent chaining.

  • methodAddRateLimiter
    public IResiliencePipelineBuilder AddRateLimiter(RateLimiterStrategyOptions options)

    Adds a rate limiter strategy to the pipeline.

    options: RateLimiterStrategyOptions
    The rate limiter strategy options.

    Retorna: The builder instance for fluent chaining.

  • methodAddRetry
    public IResiliencePipelineBuilder AddRetry(Action<RetryStrategyOptions> configure)

    Adds a retry strategy to the pipeline.

    configure: Action<RetryStrategyOptions>

    Retorna: The builder instance for fluent chaining.

  • methodAddRetry
    public IResiliencePipelineBuilder AddRetry(RetryStrategyOptions options)

    Adds a retry strategy to the pipeline.

    options: RetryStrategyOptions
    The retry strategy options.

    Retorna: The builder instance for fluent chaining.

  • methodAddTimeout
    public IResiliencePipelineBuilder AddTimeout(Action<TimeoutStrategyOptions> configure)

    Adds a timeout strategy to the pipeline.

    configure: Action<TimeoutStrategyOptions>

    Retorna: The builder instance for fluent chaining.

  • methodAddTimeout
    public IResiliencePipelineBuilder AddTimeout(TimeoutStrategyOptions options)

    Adds a timeout strategy to the pipeline.

    options: TimeoutStrategyOptions
    The timeout strategy options.

    Retorna: The builder instance for fluent chaining.

  • methodBuild
    public IResiliencePipeline Build()

    Builds and returns the compiled `IResiliencePipeline`.

    Retorna: The compiled resilience pipeline.

    Exceptions: InvalidOperationException: No pipeline compilation factory has been registered

  • methodSetPipelineFactory
    public static void SetPipelineFactory(Func<IResiliencePipelineBuilder, IResiliencePipeline> factory)

    Registers the global pipeline factory used to compile resilience builders into executable pipelines.

    factory: Func<IResiliencePipelineBuilder, IResiliencePipeline>
    The pipeline compilation factory delegate.

    Exceptions: ArgumentNullException: `factory` is `null`

  • methodSetTypedPipelineCompiler
    public static void SetTypedPipelineCompiler(ITypedPipelineCompiler compiler)

    Registers the global typed pipeline compiler used to compile any `ResiliencePipelineBuilder<TResult>`.

    compiler: ITypedPipelineCompiler
    The typed pipeline compiler instance.

    Exceptions: ArgumentNullException: `compiler` is `null`

  • methodSetTypedPipelineFactory<TResult>
    public static void SetTypedPipelineFactory<TResult>(Func<ResiliencePipelineBuilder<TResult>, IResiliencePipeline<TResult>> factory)

    Registers the global typed pipeline factory used to compile typed resilience builders into executable pipelines.

    factory: Func<ResiliencePipelineBuilder<TResult>, IResiliencePipeline<TResult>>
    The typed pipeline compilation factory delegate.

    Type parameters: TResult: The result type of the pipeline. Exceptions: ArgumentNullException: `factory` is `null`

  • propertyName
    public string Name { get; }

    Gets the unique name of the pipeline being built.

  • propertyStrategies
    public IReadOnlyList<ResilienceStrategyOptions> Strategies { get; }

    Gets the collection of configured strategy options in order of addition.

class

ResiliencePipelineBuilder<TResult>

Ensamblado: EricksonLopez.Resilience
public sealed class ResiliencePipelineBuilder<TResult>

Provides a strongly-typed resilience pipeline builder for accumulating, configuring, and compiling typed resilience strategies.

Notas:

Type parameters: TResult: The result type returned by resilient operations executed through this pipeline.

Miembros (16)

  • constructorResiliencePipelineBuilder
    public ResiliencePipelineBuilder(string name)

    Initializes a new instance of the `ResiliencePipelineBuilder<TResult>` class.

    name: string
    The unique logical name of the pipeline.

    Exceptions: ArgumentException: `name` is `null` or whitespace

  • methodAddCircuitBreaker
    public ResiliencePipelineBuilder<TResult> AddCircuitBreaker(Action<CircuitBreakerStrategyOptions> configure)

    Adds a circuit breaker resilience strategy configured via an action delegate to the typed pipeline.

    configure: Action<CircuitBreakerStrategyOptions>
    The configuration delegate.

    Retorna: The builder instance for fluent chaining.

    Exceptions: ArgumentNullException: `configure` is `null`

  • methodAddCircuitBreaker
    public ResiliencePipelineBuilder<TResult> AddCircuitBreaker(CircuitBreakerStrategyOptions options)

    Adds a circuit breaker resilience strategy to the typed pipeline.

    options: CircuitBreakerStrategyOptions
    The circuit breaker strategy options.

    Retorna: The builder instance for fluent chaining.

    Exceptions: ArgumentNullException: `options` is `null`; ResilienceConfigurationException: The circuit breaker configuration options are invalid

  • methodAddFallback
    public ResiliencePipelineBuilder<TResult> AddFallback(Action<FallbackStrategyOptions<TResult>> configure)

    Adds a strongly-typed fallback resilience strategy configured via an action delegate to the typed pipeline.

    configure: Action<FallbackStrategyOptions<TResult>>
    The configuration delegate.

    Retorna: The builder instance for fluent chaining.

    Exceptions: ArgumentNullException: `configure` is `null`

  • methodAddFallback
    public ResiliencePipelineBuilder<TResult> AddFallback(FallbackStrategyOptions<TResult> options)

    Adds a strongly-typed fallback resilience strategy to the typed pipeline.

    options: FallbackStrategyOptions<TResult>
    The fallback strategy options.

    Retorna: The builder instance for fluent chaining.

    Exceptions: ArgumentNullException: `options` is `null`; ResilienceConfigurationException: `FallbackStrategyOptions<TResult>.FallbackAction` is `null`

  • methodAddHedging
    public ResiliencePipelineBuilder<TResult> AddHedging(Action<HedgingStrategyOptions<TResult>> configure)

    Adds a strongly-typed parallel speculative hedging resilience strategy configured via an action delegate to the typed pipeline.

    configure: Action<HedgingStrategyOptions<TResult>>
    The configuration delegate.

    Retorna: The builder instance for fluent chaining.

    Exceptions: ArgumentNullException: `configure` is `null`

  • methodAddHedging
    public ResiliencePipelineBuilder<TResult> AddHedging(HedgingStrategyOptions<TResult> options)

    Adds a strongly-typed parallel speculative hedging resilience strategy to the typed pipeline.

    options: HedgingStrategyOptions<TResult>
    The hedging strategy options.

    Retorna: The builder instance for fluent chaining.

    Exceptions: ArgumentNullException: `options` is `null`; ResilienceConfigurationException: The hedging configuration options are invalid

  • methodAddRateLimiter
    public ResiliencePipelineBuilder<TResult> AddRateLimiter(Action<RateLimiterStrategyOptions> configure)

    Adds a rate limiter resilience strategy configured via an action delegate to the typed pipeline.

    configure: Action<RateLimiterStrategyOptions>
    The configuration delegate.

    Retorna: The builder instance for fluent chaining.

    Exceptions: ArgumentNullException: `configure` is `null`

  • methodAddRateLimiter
    public ResiliencePipelineBuilder<TResult> AddRateLimiter(RateLimiterStrategyOptions options)

    Adds a rate limiter resilience strategy to the typed pipeline.

    options: RateLimiterStrategyOptions
    The rate limiter strategy options.

    Retorna: The builder instance for fluent chaining.

    Exceptions: ArgumentNullException: `options` is `null`; ResilienceConfigurationException: The rate limiter configuration options are invalid

  • methodAddRetry
    public ResiliencePipelineBuilder<TResult> AddRetry(Action<RetryStrategyOptions> configure)

    Adds a retry resilience strategy configured via an action delegate to the typed pipeline.

    configure: Action<RetryStrategyOptions>
    The configuration delegate.

    Retorna: The builder instance for fluent chaining.

    Exceptions: ArgumentNullException: `configure` is `null`

  • methodAddRetry
    public ResiliencePipelineBuilder<TResult> AddRetry(RetryStrategyOptions options)

    Adds a retry resilience strategy to the typed pipeline.

    options: RetryStrategyOptions
    The retry strategy options.

    Retorna: The builder instance for fluent chaining.

    Exceptions: ArgumentNullException: `options` is `null`; ResilienceConfigurationException: The retry configuration options are invalid

  • methodAddTimeout
    public ResiliencePipelineBuilder<TResult> AddTimeout(Action<TimeoutStrategyOptions> configure)

    Adds a timeout resilience strategy configured via an action delegate to the typed pipeline.

    configure: Action<TimeoutStrategyOptions>
    The configuration delegate.

    Retorna: The builder instance for fluent chaining.

    Exceptions: ArgumentNullException: `configure` is `null`

  • methodAddTimeout
    public ResiliencePipelineBuilder<TResult> AddTimeout(TimeoutStrategyOptions options)

    Adds a timeout resilience strategy to the typed pipeline.

    options: TimeoutStrategyOptions
    The timeout strategy options.

    Retorna: The builder instance for fluent chaining.

    Exceptions: ArgumentNullException: `options` is `null`; ResilienceConfigurationException: The timeout configuration options are invalid

  • methodBuild
    public IResiliencePipeline<TResult> Build()

    Compiles the configured strategies into an executable `IResiliencePipeline<TResult>`.

    Retorna: The compiled typed resilience pipeline.

    Exceptions: InvalidOperationException: No typed pipeline compilation factory has been registered for `TResult`

  • propertyName
    public string Name { get; }

    Gets the unique logical name of the pipeline.

  • propertyStrategies
    public IReadOnlyList<ResilienceStrategyOptions> Strategies { get; }

    Gets the list of configured resilience strategies in execution order.

EricksonLopez.Resilience.Classification#

8
class

DbExceptionTransientClassifier

Ensamblado: EricksonLopez.Resilience
public sealed class DbExceptionTransientClassifier : IDatabaseTransientClassifier
Implementa: IDatabaseTransientClassifier

Default AOT-safe database transient classifier that inspects standard BCL `DbException` properties (`DbException.IsTransient`, `DbException.SqlState`, and `ExternalException.ErrorCode`) without reflection, ensuring Native AOT-compatible trimming safety for all standard ADO.NET and EF Core providers.

Miembros (2)

  • methodIsTransient
    public bool IsTransient(Exception exception)

    Determines whether the specified exception represents a transient database error eligible for retry.

    exception: Exception
    The database exception to evaluate.

    Retorna: `true` if the exception represents a transient database error; otherwise, `false`.

  • propertyInstance
    public static DbExceptionTransientClassifier Instance { get; }

    Gets the singleton instance of `DbExceptionTransientClassifier`.

class

DelegateDatabaseTransientClassifier

Ensamblado: EricksonLopez.Resilience
public sealed class DelegateDatabaseTransientClassifier : IDatabaseTransientClassifier
Implementa: IDatabaseTransientClassifier

Provides an `IDatabaseTransientClassifier` implementation backed by a user-supplied delegate.

Miembros (2)

  • constructorDelegateDatabaseTransientClassifier
    public DelegateDatabaseTransientClassifier(Func<Exception, bool> predicate)

    Initializes a new instance of the `DelegateDatabaseTransientClassifier` class.

    predicate: Func<Exception, bool>
    The transient evaluation predicate.
  • methodIsTransient
    public bool IsTransient(Exception exception)

    Determines whether the specified exception represents a transient database error eligible for retry.

    exception: Exception
    The database exception to evaluate.

    Retorna: `true` if the exception represents a transient database error; otherwise, `false`.

interface

IDatabaseTransientClassifier

Ensamblado: EricksonLopez.Resilience
public interface IDatabaseTransientClassifier

Defines a contract for evaluating database exceptions to determine if they represent transient failures (such as SQL Server deadlock 1205, PostgreSQL deadlock 40P01, or MySQL deadlock 1213) in an AOT-safe manner.

Miembros (1)

  • methodIsTransient
    bool IsTransient(Exception exception)

    Determines whether the specified exception represents a transient database error eligible for retry.

    exception: Exception
    The database exception to evaluate.

    Retorna: `true` if the exception represents a transient database error; otherwise, `false`.

interface

IErrorClassifier

Ensamblado: EricksonLopez.Resilience.Abstractions
public interface IErrorClassifier

Defines a contract for evaluating domain or infrastructure errors to determine their retryability.

Miembros (1)

  • methodClassifyError
    RetryabilityDecision ClassifyError(object? errorInstance)

    Evaluates an error object to determine if it represents a retryable transient failure.

    errorInstance: object?
    The error object (e.g., error outcome, exception, or status).

    Retorna: A `RetryabilityDecision` indicating whether the error represents a retryable transient failure.

interface

IResultRetryClassifier

Ensamblado: EricksonLopez.Resilience.Abstractions
public interface IResultRetryClassifier

Defines a contract for evaluating operation results and exceptions to classify their retryability.

Miembros (2)

  • methodClassifyException
    RetryabilityDecision ClassifyException(Exception exception)

    Evaluates an observed exception to determine if it represents a retryable transient failure.

    exception: Exception
    The exception instance.

    Retorna: `RetryabilityDecision.Retry` if the exception is a known transient fault (e.g., timeout, socket, HTTP 503); `RetryabilityDecision.DoNotRetry` if the exception is deterministic or represents a permanent failure (e.g., `System.OperationCanceledException`, `System.ArgumentException`); `RetryabilityDecision.Undetermined` if the exception type is not recognized by this classifier.

  • methodClassifyResult<T>
    RetryabilityDecision ClassifyResult<T>(T result)

    Evaluates an outcome result object to determine if it represents a retryable transient failure.

    result: T
    The outcome result instance.

    Retorna: `RetryabilityDecision.Retry` if the result is a known transient failure that should be retried; `RetryabilityDecision.DoNotRetry` if the result represents a success or a permanent non-retryable failure; `RetryabilityDecision.Undetermined` if `T` does not implement the `IResultOutcome` contract or the error cannot be classified with certainty, allowing the retry strategy to fall back to its exception-based predicate.

    Type parameters: T: The type of the result.

class

ResultRetryClassifier

Ensamblado: EricksonLopez.Resilience
public sealed class ResultRetryClassifier : IResultRetryClassifier, IErrorClassifier
Implementa: IErrorClassifier, IResultRetryClassifier

Evaluates `Result<T>`, `Result`, and domain `Error` objects alongside runtime exceptions to make deterministic retry decisions within the EricksonLopez ecosystem.

Miembros (8)

  • constructorResultRetryClassifier
    public ResultRetryClassifier()

    Initializes a new instance of the `ResultRetryClassifier` class.

  • methodClassifyError
    public RetryabilityDecision ClassifyError(object? errorInstance)

    Evaluates an error object to determine if it represents a retryable transient failure.

    errorInstance: object?
    The error object (e.g., error outcome, exception, or status).

    Retorna: A `RetryabilityDecision` indicating whether the error represents a retryable transient failure.

  • methodClassifyException
    public RetryabilityDecision ClassifyException(Exception exception)

    Evaluates an observed exception to determine if it represents a retryable transient failure.

    exception: Exception
    The exception instance.

    Retorna: `RetryabilityDecision.Retry` if the exception is a known transient fault (e.g., timeout, socket, HTTP 503); `RetryabilityDecision.DoNotRetry` if the exception is deterministic or represents a permanent failure (e.g., `System.OperationCanceledException`, `System.ArgumentException`); `RetryabilityDecision.Undetermined` if the exception type is not recognized by this classifier.

  • methodClassifyResult<T>
    public RetryabilityDecision ClassifyResult<T>(T result)

    Evaluates an outcome result object to determine if it represents a retryable transient failure.

    result: T
    The outcome result instance.

    Retorna: `RetryabilityDecision.Retry` if the result is a known transient failure that should be retried; `RetryabilityDecision.DoNotRetry` if the result represents a success or a permanent non-retryable failure; `RetryabilityDecision.Undetermined` if `T` does not implement the `IResultOutcome` contract or the error cannot be classified with certainty, allowing the retry strategy to fall back to its exception-based predicate.

    Type parameters: T: The type of the result.

  • methodClearDatabaseClassifiers
    public static void ClearDatabaseClassifiers()

    Clears custom registered database classifiers, resetting to the default classifier.

  • methodRegisterDatabaseClassifier
    public static void RegisterDatabaseClassifier(Func<Exception, bool> predicate)

    Registers a strongly-typed, AOT-safe database transient classifier delegate.

    predicate: Func<Exception, bool>
    The transient evaluation predicate.
  • methodRegisterDatabaseClassifier
    public static void RegisterDatabaseClassifier(IDatabaseTransientClassifier classifier)

    Registers a strongly-typed, AOT-safe database transient classifier.

    classifier: IDatabaseTransientClassifier
    The database transient classifier to register.
  • propertyInstance
    public static ResultRetryClassifier Instance { get; }

    Gets the shared singleton instance of the default `ResultRetryClassifier`.

enum

RetryabilityDecision

Ensamblado: EricksonLopez.Resilience.Abstractions
public enum RetryabilityDecision : byte

Specifies the deterministic classification outcome regarding whether an error or result is retryable.

Miembros (3)

  • fieldDoNotRetry
    DoNotRetry = 2

    Indicates that the failure is classified as permanent or deterministic and must not be retried.

  • fieldRetry
    Retry = 1

    Indicates that the failure is classified as transient and eligible for retry.

  • fieldUndetermined
    Undetermined = 0

    Indicates that the classification could not be determined by the classifier.

class

TransientExceptionClassifier

Ensamblado: EricksonLopez.Resilience
public static class TransientExceptionClassifier

Provides utility methods for identifying transient exceptions in .NET runtime and infrastructure components.

Miembros (1)

  • methodIsTransient
    public static bool IsTransient(Exception exception)

    Determines whether the specified exception represents a transient failure eligible for retry.

    exception: Exception
    The exception to evaluate.

    Retorna: `true` if the exception is transient; otherwise, `false`.

EricksonLopez.Resilience.DependencyInjection#

3
class

ResilienceConfigurationExtensions

Ensamblado: EricksonLopez.Resilience.DependencyInjection
public static class ResilienceConfigurationExtensions

Provides reflection-free, Native AOT-safe configuration binding extension methods for mapping resilience options from `IConfiguration` and `IConfigurationSection`.

Miembros (5)

  • methodAddResiliencePolicyFromConfiguration
    public static IServiceCollection AddResiliencePolicyFromConfiguration(this IServiceCollection services, string policyName, IConfigurationSection section)

    Configures a named resilience policy by reading its strategy settings from the specified `IConfigurationSection`.

    services: this IServiceCollection
    The service collection.
    policyName: string
    The unique policy name.
    section: IConfigurationSection
    The configuration section containing resilience parameters (e.g. Retry, CircuitBreaker, Timeout, RateLimiter).

    Retorna: The service collection for method chaining.

    Exceptions: ArgumentNullException: `services` or `section` is `null`; ArgumentException: `policyName` is `null` or whitespace

  • methodBindCircuitBreakerOptions
    public static CircuitBreakerStrategyOptions BindCircuitBreakerOptions(this IConfigurationSection section)

    Binds `CircuitBreakerStrategyOptions` from the given configuration section without using reflection.

    section: this IConfigurationSection
    The configuration section.

    Retorna: A populated `CircuitBreakerStrategyOptions` instance.

    Exceptions: ArgumentNullException: `section` is `null`

  • methodBindRateLimiterOptions
    public static RateLimiterStrategyOptions BindRateLimiterOptions(this IConfigurationSection section)

    Binds `RateLimiterStrategyOptions` from the given configuration section without using reflection.

    section: this IConfigurationSection
    The configuration section.

    Retorna: A populated `RateLimiterStrategyOptions` instance.

    Exceptions: ArgumentNullException: `section` is `null`

  • methodBindRetryOptions
    public static RetryStrategyOptions BindRetryOptions(this IConfigurationSection section)

    Binds `RetryStrategyOptions` from the given configuration section without using reflection.

    section: this IConfigurationSection
    The configuration section.

    Retorna: A populated `RetryStrategyOptions` instance.

    Exceptions: ArgumentNullException: `section` is `null`

  • methodBindTimeoutOptions
    public static TimeoutStrategyOptions BindTimeoutOptions(this IConfigurationSection section)

    Binds `TimeoutStrategyOptions` from the given configuration section without using reflection.

    section: this IConfigurationSection
    The configuration section.

    Retorna: A populated `TimeoutStrategyOptions` instance.

    Exceptions: ArgumentNullException: `section` is `null`

class

ResilienceOptions

Ensamblado: EricksonLopez.Resilience.DependencyInjection
public sealed class ResilienceOptions

Represents options for configuring the EricksonLopez resilience system during dependency injection setup.

Miembros (3)

  • constructorResilienceOptions
    public ResilienceOptions()

    Initializes a new instance of the `ResilienceOptions` class.

  • methodAddPipeline<TResult>
    public ResilienceOptions AddPipeline<TResult>(string policyName, Action<ResiliencePipelineBuilder<TResult>> configure)

    Registers a named strongly-typed resilience pipeline configured via a builder delegate.

    policyName: string
    The unique policy name.
    configure: Action<ResiliencePipelineBuilder<TResult>>
    The builder configuration action.

    Retorna: The options instance for method chaining.

    Type parameters: TResult: The result type of the resilience pipeline. Exceptions: ArgumentException: `policyName` is `null` or whitespace; ArgumentNullException: `configure` is `null`

  • methodAddPolicy
    public ResilienceOptions AddPolicy(string policyName, Action<IResiliencePipelineBuilder> configure)

    Registers a named resilience policy configured via a builder delegate.

    policyName: string
    The unique policy name.
    configure: Action<IResiliencePipelineBuilder>
    The builder configuration action.

    Retorna: The options instance for method chaining.

    Exceptions: ArgumentException: `policyName` is `null` or whitespace; ArgumentNullException: `configure` is `null`

class

ResilienceServiceCollectionExtensions

Ensamblado: EricksonLopez.Resilience.DependencyInjection
public static class ResilienceServiceCollectionExtensions

Provides extension methods for registering EricksonLopez resilience services into `IServiceCollection`.

Miembros (6)

  • methodAddEricksonLopezResilience
    public static IServiceCollection AddEricksonLopezResilience(this IServiceCollection services, Action<ResilienceOptions>? configure = null)

    Registers the core resilience infrastructure, Polly execution adapter, pipeline registries, and error classifiers.

    services: this IServiceCollection
    The service collection.
    configure: Action<ResilienceOptions>?
    An optional configuration delegate for registering initial policies.

    Retorna: The service collection for method chaining.

    Exceptions: ArgumentNullException: `services` is `null`

  • methodAddResiliencePipeline<TResult>
    public static IServiceCollection AddResiliencePipeline<TResult>(this IServiceCollection services, string policyName, Action<ResiliencePipelineBuilder<TResult>, IServiceProvider> configure)

    Registers a named strongly-typed resilience pipeline configured via an action delegate providing access to `IServiceProvider` and compiles it into the runtime pipeline registry.

    services: this IServiceCollection
    The service collection.
    policyName: string
    The unique policy name.
    configure: Action<ResiliencePipelineBuilder<TResult>, IServiceProvider>
    The builder configuration action that provides `IServiceProvider`.

    Retorna: The service collection for method chaining.

    Type parameters: TResult: The result type returned by the resilience pipeline. Exceptions: ArgumentNullException: `services` or `configure` is `null`; ArgumentException: `policyName` is `null` or whitespace

  • methodAddResiliencePipeline<TResult>
    public static IServiceCollection AddResiliencePipeline<TResult>(this IServiceCollection services, string policyName, Action<ResiliencePipelineBuilder<TResult>> configure)

    Registers a named strongly-typed resilience pipeline configured via an action delegate and compiles it into the runtime pipeline registry.

    services: this IServiceCollection
    The service collection.
    policyName: string
    The unique policy name.
    configure: Action<ResiliencePipelineBuilder<TResult>>
    The builder configuration action.

    Retorna: The service collection for method chaining.

    Type parameters: TResult: The result type returned by the resilience pipeline. Exceptions: ArgumentNullException: `services` or `configure` is `null`; ArgumentException: `policyName` is `null` or whitespace

  • methodAddResiliencePolicy
    public static IServiceCollection AddResiliencePolicy(this IServiceCollection services, string policyName, Action<IResiliencePipelineBuilder, IServiceProvider> configure)

    Registers a named resilience policy configured via an action delegate providing access to `IServiceProvider` and compiles it into the runtime pipeline registry.

    services: this IServiceCollection
    The service collection.
    policyName: string
    The unique policy name.
    configure: Action<IResiliencePipelineBuilder, IServiceProvider>
    The builder configuration action that provides `IServiceProvider`.

    Retorna: The service collection for method chaining.

    Exceptions: ArgumentNullException: `services` or `configure` is `null`; ArgumentException: `policyName` is `null` or whitespace

  • methodAddResiliencePolicy
    public static IServiceCollection AddResiliencePolicy(this IServiceCollection services, string policyName, Action<IResiliencePipelineBuilder> configure)

    Registers a named resilience policy configured via an action delegate and compiles it into the runtime pipeline registry.

    services: this IServiceCollection
    The service collection.
    policyName: string
    The unique policy name.
    configure: Action<IResiliencePipelineBuilder>
    The builder configuration action.

    Retorna: The service collection for method chaining.

    Exceptions: ArgumentNullException: `services` or `configure` is `null`; ArgumentException: `policyName` is `null` or whitespace

  • methodAddResiliencePolicy<TPolicy>
    public static IServiceCollection AddResiliencePolicy<TPolicy>(this IServiceCollection services) where TPolicy : class, IResiliencePolicy

    Registers a strongly-typed resilience policy and compiles it into the runtime pipeline registry.

    services: this IServiceCollection
    The service collection.

    Retorna: The service collection for method chaining.

    Type parameters: TPolicy: The type of the resilience policy. Exceptions: ArgumentNullException: `services` is `null`

EricksonLopez.Resilience.Exceptions#

6
class

CircuitBrokenException

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class CircuitBrokenException : ResilienceException
Hereda de: ResilienceException

Represents the exception thrown when an execution is rejected because the circuit breaker is currently in the Open state.

Miembros (4)

  • constructorCircuitBrokenException
    public CircuitBrokenException(string policyName, TimeSpan? retryAfter = null)

    Initializes a new instance of the `CircuitBrokenException` class.

    policyName: string
    The policy name associated with the open circuit.
    retryAfter: TimeSpan?
    The duration remaining before the circuit transitions to half-open, if available.
  • constructorCircuitBrokenException
    public CircuitBrokenException(string policyName, TimeSpan? retryAfter, Exception innerException)

    Initializes a new instance of the `CircuitBrokenException` class with an inner exception.

    policyName: string
    The policy name associated with the open circuit.
    retryAfter: TimeSpan?
    The duration remaining before the circuit transitions to half-open, if available.
    innerException: Exception
    The inner exception that originally opened the circuit.
  • propertyPolicyName
    public string PolicyName { get; }

    Gets the name of the policy whose circuit is open.

  • propertyRetryAfter
    public TimeSpan? RetryAfter { get; }

    Gets the optional retry-after duration remaining on the break.

class

RateLimitRejectedException

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class RateLimitRejectedException : ResilienceException
Hereda de: ResilienceException

Represents the exception thrown when an operation execution is rejected due to active rate limiting constraints.

Miembros (4)

  • constructorRateLimitRejectedException
    public RateLimitRejectedException(string policyName, TimeSpan? retryAfter = null)

    Initializes a new instance of the `RateLimitRejectedException` class.

    policyName: string
    The policy name enforcing rate limiting.
    retryAfter: TimeSpan?
    The duration to wait before retrying the operation, if available.
  • constructorRateLimitRejectedException
    public RateLimitRejectedException(string policyName, TimeSpan? retryAfter, Exception innerException)

    Initializes a new instance of the `RateLimitRejectedException` class with an inner exception.

    policyName: string
    The policy name enforcing rate limiting.
    retryAfter: TimeSpan?
    The duration to wait before retrying the operation, if available.
    innerException: Exception
    The inner exception associated with the rejection.
  • propertyPolicyName
    public string PolicyName { get; }

    Gets the name of the policy that rejected the execution.

  • propertyRetryAfter
    public TimeSpan? RetryAfter { get; }

    Gets the optional retry-after duration suggested by the rate limiter.

class

ResilienceConfigurationException

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class ResilienceConfigurationException : ResilienceException
Hereda de: ResilienceException

Represents the exception thrown when a resilience strategy or pipeline configuration contains invalid options or invariants.

Miembros (2)

  • constructorResilienceConfigurationException
    public ResilienceConfigurationException(string message)

    Initializes a new instance of the `ResilienceConfigurationException` class.

    message: string
    The message describing the invalid configuration.
  • constructorResilienceConfigurationException
    public ResilienceConfigurationException(string message, Exception innerException)

    Initializes a new instance of the `ResilienceConfigurationException` class with an inner exception.

    message: string
    The message describing the invalid configuration.
    innerException: Exception
    The inner exception that caused the configuration failure.
class

ResilienceException

Ensamblado: EricksonLopez.Resilience.Abstractions
public class ResilienceException : Exception
Hereda de: Exception

Represents the base exception type for all resilience-related errors in the EricksonLopez ecosystem.

Miembros (3)

  • constructorResilienceException
    public ResilienceException()

    Initializes a new instance of the `ResilienceException` class with a default error message.

  • constructorResilienceException
    public ResilienceException(string message)

    Initializes a new instance of the `ResilienceException` class with a specified error message.

    message: string
    The message that describes the error.
  • constructorResilienceException
    public ResilienceException(string message, Exception innerException)

    Initializes a new instance of the `ResilienceException` class with a specified error message and inner exception.

    message: string
    The message that describes the error.
    innerException: Exception
    The inner exception that is the cause of the current exception.
class

ResiliencePolicyNotFoundException

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class ResiliencePolicyNotFoundException : ResilienceException
Hereda de: ResilienceException

Represents the exception thrown when a requested resilience policy name cannot be resolved from the registry.

Miembros (2)

  • constructorResiliencePolicyNotFoundException
    public ResiliencePolicyNotFoundException(string policyName)

    Initializes a new instance of the `ResiliencePolicyNotFoundException` class.

    policyName: string
    The name of the unresolved policy.
  • propertyPolicyName
    public string PolicyName { get; }

    Gets the name of the unresolved policy.

class

ResilienceTimeoutException

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class ResilienceTimeoutException : ResilienceException
Hereda de: ResilienceException

Represents the exception thrown when an operation execution exceeds the configured resilience timeout duration.

Miembros (4)

  • constructorResilienceTimeoutException
    public ResilienceTimeoutException(TimeSpan timeout, string? policyName = null)

    Initializes a new instance of the `ResilienceTimeoutException` class.

    timeout: TimeSpan
    The configured timeout duration that was exceeded.
    policyName: string?
    The optional policy name under which timeout occurred.
  • constructorResilienceTimeoutException
    public ResilienceTimeoutException(TimeSpan timeout, string? policyName, Exception innerException)

    Initializes a new instance of the `ResilienceTimeoutException` class with an inner exception.

    timeout: TimeSpan
    The configured timeout duration that was exceeded.
    policyName: string?
    The optional policy name under which timeout occurred.
    innerException: Exception
    The inner exception associated with the timeout.
  • propertyPolicyName
    public string? PolicyName { get; }

    Gets the optional policy name under which timeout occurred.

  • propertyTimeout
    public TimeSpan Timeout { get; }

    Gets the timeout duration that was exceeded.

EricksonLopez.Resilience.Extensions#

1
class

ResiliencePipelineBuilderExtensions

Ensamblado: EricksonLopez.Resilience
public static class ResiliencePipelineBuilderExtensions

Provides extension methods for `IResiliencePipelineBuilder` to configure common resilience patterns.

Miembros (12)

  • methodAddBulkhead
    public static IResiliencePipelineBuilder AddBulkhead(this IResiliencePipelineBuilder builder, int maxConcurrency, int maxQueue = 0)

    Adds a bulkhead concurrency limiter strategy to the pipeline restricting maximum concurrent executions.

    builder: this IResiliencePipelineBuilder
    The pipeline builder.
    maxConcurrency: int
    The maximum number of concurrent executions permitted.
    maxQueue: int
    The maximum number of queued execution requests. Defaults to 0.

    Retorna: The pipeline builder for method chaining.

    Exceptions: ArgumentNullException: `builder` is `null`

  • methodAddBulkhead<TResult>
    public static ResiliencePipelineBuilder<TResult> AddBulkhead<TResult>(this ResiliencePipelineBuilder<TResult> builder, int maxConcurrency, int maxQueue = 0)

    Adds a bulkhead concurrency limiter strategy to the typed pipeline restricting maximum concurrent executions.

    builder: this ResiliencePipelineBuilder<TResult>
    The pipeline builder.
    maxConcurrency: int
    The maximum number of concurrent executions permitted.
    maxQueue: int
    The maximum number of queued execution requests. Defaults to 0.

    Retorna: The pipeline builder for method chaining.

    Type parameters: TResult: The result type of the pipeline. Exceptions: ArgumentNullException: `builder` is `null`

  • methodAddConcurrencyLimiter
    public static IResiliencePipelineBuilder AddConcurrencyLimiter(this IResiliencePipelineBuilder builder, int maxConcurrency, int maxQueue = 0)

    Adds a concurrency limiter strategy to the pipeline restricting maximum concurrent executions.

    builder: this IResiliencePipelineBuilder
    The pipeline builder.
    maxConcurrency: int
    The maximum number of concurrent executions permitted.
    maxQueue: int
    The maximum number of queued execution requests. Defaults to 0.

    Retorna: The pipeline builder for method chaining.

    Exceptions: ArgumentNullException: `builder` is `null`

  • methodAddConcurrencyLimiter<TResult>
    public static ResiliencePipelineBuilder<TResult> AddConcurrencyLimiter<TResult>(this ResiliencePipelineBuilder<TResult> builder, int maxConcurrency, int maxQueue = 0)

    Adds a concurrency limiter strategy to the typed pipeline restricting maximum concurrent executions.

    builder: this ResiliencePipelineBuilder<TResult>
    The pipeline builder.
    maxConcurrency: int
    The maximum number of concurrent executions permitted.
    maxQueue: int
    The maximum number of queued execution requests. Defaults to 0.

    Retorna: The pipeline builder for method chaining.

    Type parameters: TResult: The result type of the pipeline. Exceptions: ArgumentNullException: `builder` is `null`

  • methodAddDatabaseResilience
    public static IResiliencePipelineBuilder AddDatabaseResilience(this IResiliencePipelineBuilder builder, TimeSpan? timeout = null, int maxRetries = 3)

    Adds a database resilience preset optimized for transient connection drops and transient serialization failures.

    builder: this IResiliencePipelineBuilder
    The pipeline builder.
    timeout: TimeSpan?
    The optional overall execution timeout duration.
    maxRetries: int
    The maximum number of retry attempts.

    Retorna: The pipeline builder for method chaining.

    Exceptions: ArgumentNullException: `builder` is `null`

  • methodAddDatabaseResilience<TResult>
    public static ResiliencePipelineBuilder<TResult> AddDatabaseResilience<TResult>(this ResiliencePipelineBuilder<TResult> builder, TimeSpan? timeout = null, int maxRetries = 3)

    Adds a database resilience preset optimized for transient connection drops and transient serialization failures to a typed pipeline.

    builder: this ResiliencePipelineBuilder<TResult>
    The pipeline builder.
    timeout: TimeSpan?
    The optional overall execution timeout duration.
    maxRetries: int
    The maximum number of retry attempts.

    Retorna: The pipeline builder for method chaining.

    Type parameters: TResult: The result type of the pipeline. Exceptions: ArgumentNullException: `builder` is `null`

  • methodAddResultRetry
    public static IResiliencePipelineBuilder AddResultRetry(this IResiliencePipelineBuilder builder, Action<RetryStrategyOptions>? configure = null, IResultRetryClassifier? classifier = null)

    Adds a retry strategy configured to evaluate `Result.Result<T>`, `Result.Result`, and domain errors for transient retryability.

    builder: this IResiliencePipelineBuilder
    The pipeline builder.
    configure: Action<RetryStrategyOptions>?
    An optional configuration action for fine-tuning retry options.
    classifier: IResultRetryClassifier?
    An optional custom classifier instance.

    Retorna: The pipeline builder for method chaining.

    Exceptions: ArgumentNullException: `builder` is `null`

  • methodAddResultRetry<TResult>
    public static ResiliencePipelineBuilder<TResult> AddResultRetry<TResult>(this ResiliencePipelineBuilder<TResult> builder, Action<RetryStrategyOptions>? configure = null, IResultRetryClassifier? classifier = null)

    Adds a retry strategy configured to evaluate `Result.Result<T>`, `Result.Result`, and domain errors for transient retryability in a typed pipeline.

    builder: this ResiliencePipelineBuilder<TResult>
    The pipeline builder.
    configure: Action<RetryStrategyOptions>?
    An optional configuration action for fine-tuning retry options.
    classifier: IResultRetryClassifier?
    An optional custom classifier instance.

    Retorna: The pipeline builder for method chaining.

    Type parameters: TResult: The result type of the pipeline. Exceptions: ArgumentNullException: `builder` is `null`

  • methodAddStandardResilience
    public static IResiliencePipelineBuilder AddStandardResilience(this IResiliencePipelineBuilder builder)

    Adds a standard resilience pipeline preset comprising timeout, retry with exponential jitter, and a circuit breaker.

    builder: this IResiliencePipelineBuilder
    The pipeline builder.

    Retorna: The pipeline builder for method chaining.

    Exceptions: ArgumentNullException: `builder` is `null`

  • methodAddStandardResilience<TResult>
    public static ResiliencePipelineBuilder<TResult> AddStandardResilience<TResult>(this ResiliencePipelineBuilder<TResult> builder)

    Adds a standard resilience pipeline preset comprising timeout, retry with exponential jitter, and a circuit breaker to a typed pipeline.

    builder: this ResiliencePipelineBuilder<TResult>
    The pipeline builder.

    Retorna: The pipeline builder for method chaining.

    Type parameters: TResult: The result type of the pipeline. Exceptions: ArgumentNullException: `builder` is `null`

  • methodAddTimeout
    public static IResiliencePipelineBuilder AddTimeout(this IResiliencePipelineBuilder builder, TimeSpan timeout)

    Adds a timeout strategy to the pipeline with the specified timeout duration.

    builder: this IResiliencePipelineBuilder
    The pipeline builder.
    timeout: TimeSpan
    The timeout duration.

    Retorna: The pipeline builder for method chaining.

    Exceptions: ArgumentNullException: `builder` is `null`

  • methodAddTimeout<TResult>
    public static ResiliencePipelineBuilder<TResult> AddTimeout<TResult>(this ResiliencePipelineBuilder<TResult> builder, TimeSpan timeout)

    Adds a timeout strategy to the typed pipeline with the specified timeout duration.

    builder: this ResiliencePipelineBuilder<TResult>
    The pipeline builder.
    timeout: TimeSpan
    The timeout duration.

    Retorna: The pipeline builder for method chaining.

    Type parameters: TResult: The result type of the pipeline. Exceptions: ArgumentNullException: `builder` is `null`

EricksonLopez.Resilience.Mediator.Behaviors#

1
class

ResiliencePipelineBehavior<TRequest, TResponse>

Ensamblado: EricksonLopez.Resilience.Mediator
public sealed class ResiliencePipelineBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
Implementa: IPipelineBehavior<TRequest, TResponse>

Provides an open generic pipeline behavior that executes mediator requests declaring resilience requirements through `IResilienceExecutor`.

Notas:

Type parameters: TRequest: The type of the request being processed.; TResponse: The type of the response expected from the pipeline.

Miembros (2)

  • constructorResiliencePipelineBehavior
    public ResiliencePipelineBehavior(IResilienceExecutor resilienceExecutor)

    Initializes a new instance of the `ResiliencePipelineBehavior<TRequest, TResponse>` class.

    resilienceExecutor: IResilienceExecutor
    The resilience executor instance.

    Exceptions: ArgumentNullException: `resilienceExecutor` is `null`

  • methodHandle<TNext>
    public async ValueTask<TResponse> Handle<TNext>(TRequest request, TNext next, CancellationToken cancellationToken) where TNext : struct, INext<TResponse>

    Inherits documentation from base type or interface.

    request: TRequest
    next: TNext
    cancellationToken: CancellationToken

EricksonLopez.Resilience.Mediator.Contracts#

1
interface

IResilientRequest

Ensamblado: EricksonLopez.Resilience.Mediator
public interface IResilientRequest

Defines a contract for mediator requests that declare an explicit named resilience policy for execution.

Notas:

By implementing this interface, the mediator pipeline behavior automatically intercepts and dispatches the request execution through the corresponding resilience policy without reflection.

Miembros (1)

  • propertyResiliencePolicy
    string ResiliencePolicy { get; }

    Gets the unique name of the resilience policy to apply during request execution.

EricksonLopez.Resilience.Mediator.Extensions#

1
class

MediatorResilienceExtensions

Ensamblado: EricksonLopez.Resilience.Mediator
public static class MediatorResilienceExtensions

Provides extension methods for registering resilience pipeline behaviors into the mediator pipeline.

Miembros (1)

  • methodAddResiliencePipelineBehavior
    public static IServiceCollection AddResiliencePipelineBehavior(this IServiceCollection services)

    Registers the `ResiliencePipelineBehavior<TRequest, TResponse>` as an open generic pipeline behavior in DI.

    services: this IServiceCollection
    The service collection.

    Retorna: The service collection for method chaining.

    Exceptions: ArgumentNullException: `services` is `null`

EricksonLopez.Resilience.OpenTelemetry#

2
class

ResilienceActivitySource

Ensamblado: EricksonLopez.Resilience.OpenTelemetry
public static partial class ResilienceActivitySource

Provides OpenTelemetry activity source tracing instrumentation for the EricksonLopez resilience ecosystem.

Miembros (10)

  • methodAttachRequestPayload
    public static void AttachRequestPayload(Activity? activity, string? payload, int maxPayloadLength = 1024)

    Attaches the request payload to the activity if `EnrichWithPayload` is enabled.

    activity: Activity?
    The activity.
    payload: string?
    The request payload string.
    maxPayloadLength: int
    The maximum length to attach before truncating.
  • methodAttachResponsePayload
    public static void AttachResponsePayload(Activity? activity, string? payload, int maxPayloadLength = 1024)

    Attaches the response payload to the activity if `EnrichWithPayload` is enabled.

    activity: Activity?
    The activity.
    payload: string?
    The response payload string.
    maxPayloadLength: int
    The maximum length to attach before truncating.
  • methodDefaultSanitize
    public static (string Message, string StackTrace) DefaultSanitize(Exception ex)

    Redacts sensitive credentials (connection strings, tokens, passwords, API keys) from an exception.

    ex: Exception
    The exception to sanitize.

    Retorna: The sanitized message and stack trace.

  • methodRecordException
    public static void RecordException(Activity? activity, Exception exception)

    Records an exception event on the specified activity following OpenTelemetry semantic conventions, ensuring credentials are redacted.

    activity: Activity?
    The active activity.
    exception: Exception
    The exception to record.
  • methodSanitizeString
    public static string SanitizeString(string? input)

    Redacts sensitive credentials from the specified string.

    input: string?
    The input string.

    Retorna: The redacted string.

  • methodStartExecutionActivity
    public static Activity? StartExecutionActivity(string policyName, string operationName, string? tenantId = null, string? correlationId = null)

    Starts a new tracing activity for a resilient operation execution.

    policyName: string
    The policy name.
    operationName: string
    The operation name.
    tenantId: string?
    The optional tenant identifier.
    correlationId: string?
    The optional correlation identifier.

    Retorna: A new `Activity` instance, or `null` if tracing is not enabled.

  • propertyEnrichWithPayload
    public static bool EnrichWithPayload { get; set; }

    Gets or sets a value indicating whether request and response payloads may be attached to trace activities. Defaults to `false` to prevent credential and PII leakage into distributed traces.

  • propertyExceptionSanitizer
    public static Func<Exception,(string Message, string StackTrace)>? ExceptionSanitizer { get; set; }

    Gets or sets an optional delegate to redact sensitive information from recorded exception messages and stack traces. Defaults to `DefaultSanitize`.

  • fieldSourceName
    public const string SourceName

    Gets the name of the OpenTelemetry activity source.

  • fieldSourceVersion
    public const string SourceVersion

    Gets the version of the OpenTelemetry activity source.

class

ResilienceMeter

Ensamblado: EricksonLopez.Resilience.OpenTelemetry
public static partial class ResilienceMeter

Provides OpenTelemetry metrics instrumentation for the EricksonLopez resilience ecosystem.

Miembros (12)

  • methodNormalizeOperationName
    public static string NormalizeOperationName(string? operationName)

    Normalizes an operation name or route template to bound cardinality by replacing GUIDs with {guid}, numeric IDs with {id}, stripping query strings, and truncating to `MaxOperationNameLength`.

    operationName: string?
    The operation name to normalize.

    Retorna: The normalized, bounded operation name.

  • methodRecordCircuitBreakerRejection
    public static void RecordCircuitBreakerRejection(string policyName, string operationName, string? tenantId = null)

    Records a circuit breaker rejection due to open circuit state.

    policyName: string
    The policy name.
    operationName: string
    The operation name.
    tenantId: string?
    The optional tenant identifier.
  • methodRecordCircuitStateChange
    public static void RecordCircuitStateChange(string policyName, CircuitBreakerState state, string? tenantId = null)

    Records a circuit breaker state transition.

    policyName: string
    The policy name.
    state: CircuitBreakerState
    The new circuit breaker state.
    tenantId: string?
    The optional tenant identifier.
  • methodRecordExecution
    public static void RecordExecution(string policyName, string operationName, double durationMs, bool isSuccess, string? tenantId = null)

    Records the execution duration and outcome of a resilient operation.

    policyName: string
    The policy name.
    operationName: string
    The operation name.
    durationMs: double
    The execution duration in milliseconds.
    isSuccess: bool
    A value indicating whether the execution succeeded.
    tenantId: string?
    The optional tenant identifier.
  • methodRecordRateLimitRejection
    public static void RecordRateLimitRejection(string policyName, string operationName, string? tenantId = null)

    Records a rate limiter rejection.

    policyName: string
    The policy name.
    operationName: string
    The operation name.
    tenantId: string?
    The optional tenant identifier.
  • methodRecordRetry
    public static void RecordRetry(string policyName, string operationName, int attemptNumber, string? tenantId = null)

    Records a retry attempt for a given policy and operation.

    policyName: string
    The policy name.
    operationName: string
    The operation name.
    attemptNumber: int
    The attempt number.
    tenantId: string?
    The optional tenant identifier.
  • methodRecordTimeout
    public static void RecordTimeout(string policyName, string operationName, string? tenantId = null)

    Records a timeout rejection.

    policyName: string
    The policy name.
    operationName: string
    The operation name.
    tenantId: string?
    The optional tenant identifier.
  • propertyIncludeOperationNameTag
    public static bool IncludeOperationNameTag { get; set; }

    Gets or sets a value indicating whether operation names should be included in metric tags. Defaults to `true`.

  • propertyIncludeTenantIdTag
    public static bool IncludeTenantIdTag { get; set; }

    Gets or sets a value indicating whether tenant identifiers should be included in metric tags. Defaults to `false` to prevent metric cardinality explosion in multi-tenant environments.

  • propertyMaxOperationNameLength
    public static int MaxOperationNameLength { get; set; }

    Gets or sets the maximum length for operation name tags. Longer strings are truncated to prevent unbounded cardinality. Defaults to 64 characters.

  • fieldMeterName
    public const string MeterName

    Gets the name of the OpenTelemetry meter.

  • fieldMeterVersion
    public const string MeterVersion

    Gets the version of the OpenTelemetry meter.

EricksonLopez.Resilience.OpenTelemetry.Extensions#

1
class

OpenTelemetryResilienceExtensions

Ensamblado: EricksonLopez.Resilience.OpenTelemetry
public static class OpenTelemetryResilienceExtensions

Provides extension methods for attaching OpenTelemetry metrics and tracing callbacks to resilience strategy options.

Miembros (3)

  • methodWithTelemetry
    public static CircuitBreakerStrategyOptions WithTelemetry(this CircuitBreakerStrategyOptions options)

    Attaches OpenTelemetry telemetry recording hooks to the configured circuit breaker strategy options.

    options: this CircuitBreakerStrategyOptions
    The circuit breaker strategy options.

    Retorna: The options instance for method chaining.

    Exceptions: ArgumentNullException: `options` is `null`

  • methodWithTelemetry
    public static RetryStrategyOptions WithTelemetry(this RetryStrategyOptions options)

    Attaches OpenTelemetry telemetry recording hooks to the configured retry strategy options.

    options: this RetryStrategyOptions
    The retry strategy options.

    Retorna: The options instance for method chaining.

    Exceptions: ArgumentNullException: `options` is `null`

  • methodWithTelemetry
    public static TimeoutStrategyOptions WithTelemetry(this TimeoutStrategyOptions options)

    Attaches OpenTelemetry telemetry recording hooks to the configured timeout strategy options.

    options: this TimeoutStrategyOptions
    The timeout strategy options.

    Retorna: The options instance for method chaining.

    Exceptions: ArgumentNullException: `options` is `null`

EricksonLopez.Resilience.Options#

17
enum

BackoffType

Ensamblado: EricksonLopez.Resilience.Abstractions
public enum BackoffType : byte

Specifies the algorithm used to calculate backoff delays between retry attempts.

Miembros (4)

  • fieldConstant
    Constant = 0

    Indicates that delays between retries are constant (fixed interval).

  • fieldExponential
    Exponential = 2

    Indicates that delays between retries increase exponentially (2^attempt * base delay).

  • fieldExponentialWithJitter
    ExponentialWithJitter = 3

    Indicates that delays between retries increase exponentially with full jitter applied to prevent thundering herd problems.

  • fieldLinear
    Linear = 1

    Indicates that delays between retries increase linearly with each attempt.

enum

CircuitBreakerState

Ensamblado: EricksonLopez.Resilience.Abstractions
public enum CircuitBreakerState : byte

Specifies the operational state of a circuit breaker.

Miembros (4)

  • fieldClosed
    Closed = 0

    Indicates that the circuit is closed and executions are permitted normally.

  • fieldHalfOpen
    HalfOpen = 2

    Indicates that the circuit is half-open and a limited number of trial executions are permitted to evaluate system recovery.

  • fieldIsolated
    Isolated = 3

    Indicates that the circuit is manually isolated and all executions are rejected until manually closed.

  • fieldOpen
    Open = 1

    Indicates that the circuit is open and executions are short-circuited and rejected immediately.

class

CircuitBreakerStateContext

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class CircuitBreakerStateContext

Provides contextual information when a circuit breaker state transition occurs.

Miembros (5)

  • constructorCircuitBreakerStateContext
    public CircuitBreakerStateContext(ResilienceContext? resilienceContext, CircuitBreakerState state, TimeSpan? breakDuration = null, Exception? lastException = null)

    Initializes a new instance of the `CircuitBreakerStateContext` class.

    resilienceContext: ResilienceContext?
    The active execution context, if available during transition.
    state: CircuitBreakerState
    The new state the circuit breaker transitioned into.
    breakDuration: TimeSpan?
    The remaining or configured duration of the break if the circuit opened.
    lastException: Exception?
    The last exception observed prior to state transition, if any.
  • propertyBreakDuration
    public TimeSpan? BreakDuration { get; }

    Gets the duration the circuit will remain open before attempting a half-open trial.

  • propertyLastException
    public Exception? LastException { get; }

    Gets the last exception associated with the state change.

  • propertyResilienceContext
    public ResilienceContext? ResilienceContext { get; }

    Gets the execution context associated with the transition, if available.

  • propertyState
    public CircuitBreakerState State { get; }

    Gets the current state of the circuit breaker.

class

CircuitBreakerStrategyOptions

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class CircuitBreakerStrategyOptions : ResilienceStrategyOptions
Hereda de: ResilienceStrategyOptions

Defines configuration options for the circuit breaker resilience strategy.

Miembros (10)

  • constructorCircuitBreakerStrategyOptions
    public CircuitBreakerStrategyOptions()

    Initializes a new instance of the `CircuitBreakerStrategyOptions` class with default settings.

  • propertyBreakDuration
    public TimeSpan BreakDuration { get; set; }

    Gets or sets the duration the circuit remains open before transitioning to half-open state. Default is 10 seconds. Minimum allowed duration is 10 milliseconds.

  • propertyFailureRatio
    public double FailureRatio { get; set; }

    Gets or sets the failure ratio (between 0.0 and 1.0) that causes the circuit to open. Default is 0.5 (50% failure rate).

  • propertyMinimumThroughput
    public int MinimumThroughput { get; set; }

    Gets or sets the minimum number of execution attempts within the sampling duration required before the failure ratio is evaluated. Default is 20 throughput executions.

  • propertyOnCircuitClosed
    public Func<CircuitBreakerStateContext, ValueTask>? OnCircuitClosed { get; set; }

    Gets or sets an asynchronous callback invoked when the circuit transitions to the `CircuitBreakerState.Closed` state.

  • propertyOnCircuitHalfOpened
    public Func<CircuitBreakerStateContext, ValueTask>? OnCircuitHalfOpened { get; set; }

    Gets or sets an asynchronous callback invoked when the circuit transitions to the `CircuitBreakerState.HalfOpen` state.

  • propertyOnCircuitOpened
    public Func<CircuitBreakerStateContext, ValueTask>? OnCircuitOpened { get; set; }

    Gets or sets an asynchronous callback invoked when the circuit transitions to the `CircuitBreakerState.Open` state.

  • propertySamplingDuration
    public TimeSpan SamplingDuration { get; set; }

    Gets or sets the duration of the rolling sampling window over which failure statistics are measured. Default is 30 seconds.

  • propertyShouldHandleException
    public Func<Exception, bool>? ShouldHandleException { get; set; }

    Gets or sets an optional predicate to determine whether an observed exception contributes to the failure ratio.

  • propertyShouldHandleResult
    public Func<object?, bool>? ShouldHandleResult { get; set; }

    Gets or sets an optional predicate to determine whether an observed result value contributes to the failure ratio.

class

FallbackContext

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class FallbackContext

Provides contextual information when a fallback strategy is evaluated or executed.

Miembros (4)

  • constructorFallbackContext
    public FallbackContext(ResilienceContext context, Exception? exception = null, object? result = null)

    Initializes a new instance of the `FallbackContext` class.

    context: ResilienceContext
    The ambient resilience context.
    exception: Exception?
    The exception that triggered the fallback, if any.
    result: object?
    The outcome result that triggered the fallback, if any.

    Exceptions: ArgumentNullException: `context` is `null`

  • propertyContext
    public ResilienceContext Context { get; }

    Gets the ambient resilience context.

  • propertyException
    public Exception? Exception { get; }

    Gets the exception that caused the operation failure, or `null` if the failure was outcome-based.

  • propertyResult
    public object? Result { get; }

    Gets the outcome result that triggered the fallback, or `null` if the failure was exception-based.

class

FallbackStrategyOptions<TResult>

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class FallbackStrategyOptions<TResult> : ResilienceStrategyOptions
Hereda de: ResilienceStrategyOptions

Defines configuration options for the strongly-typed fallback resilience strategy.

Notas:

Type parameters: TResult: The type of value returned by the resilient operation and fallback generator.

Miembros (5)

  • constructorFallbackStrategyOptions
    public FallbackStrategyOptions()

    Initializes a new instance of the `FallbackStrategyOptions<TResult>` class with default settings.

  • propertyFallbackAction
    public Func<FallbackContext, ValueTask<TResult>>? FallbackAction { get; set; }

    Gets or sets the asynchronous delegate responsible for generating the fallback `TResult` value.

  • propertyOnFallback
    public Func<FallbackContext, ValueTask>? OnFallback { get; set; }

    Gets or sets an optional asynchronous callback invoked whenever the fallback action is triggered.

  • propertyShouldHandleException
    public Func<Exception, bool>? ShouldHandleException { get; set; }

    Gets or sets an optional predicate determining which exceptions trigger the fallback strategy.

  • propertyShouldHandleResult
    public Func<TResult, bool>? ShouldHandleResult { get; set; }

    Gets or sets an optional predicate determining which outcome results trigger the fallback strategy.

class

HedgingContext

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class HedgingContext

Provides contextual information when a hedged execution attempt is initiated.

Miembros (3)

  • constructorHedgingContext
    public HedgingContext(ResilienceContext resilienceContext, int attemptNumber)

    Initializes a new instance of the `HedgingContext` class.

    resilienceContext: ResilienceContext
    The active execution context.
    attemptNumber: int
    The 1-based attempt number of the hedged execution.

    Exceptions: ArgumentNullException: `resilienceContext` is `null`

  • propertyAttemptNumber
    public int AttemptNumber { get; }

    Gets the 1-based index of the hedged attempt being spawned.

  • propertyResilienceContext
    public ResilienceContext ResilienceContext { get; }

    Gets the execution context.

class

HedgingStrategyOptions

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class HedgingStrategyOptions : ResilienceStrategyOptions
Hereda de: ResilienceStrategyOptions

Defines configuration options for the untyped hedging resilience strategy.

Notas:

In untyped pipelines, hedging operates as a speculative retry mechanism — the pipeline re-executes the same delegate sequentially after `Delay` if the previous attempt fails. This does not launch parallel concurrent executions; that behavior requires a typed pipeline via `HedgingStrategyOptions<TResult>`. WARNING: Hedging must only be configured for safe, idempotent, and side-effect-free operations (such as read-only queries).

Miembros (5)

  • constructorHedgingStrategyOptions
    public HedgingStrategyOptions()

    Initializes a new instance of the `HedgingStrategyOptions` class with default settings.

  • propertyDelay
    public TimeSpan Delay { get; set; }

    Gets or sets the delay duration before spawning the next speculative attempt. Default is 500 milliseconds.

  • propertyMaxHedgedAttempts
    public int MaxHedgedAttempts { get; set; }

    Gets or sets the maximum number of additional speculative retry attempts allowed. Default is 2 attempts.

  • propertyShouldHandleException
    public Func<Exception, bool>? ShouldHandleException { get; set; }

    Gets or sets an optional predicate to determine whether an exception triggers a fast retry without waiting for delay.

  • propertyShouldHandleResult
    public Func<object?, bool>? ShouldHandleResult { get; set; }

    Gets or sets an optional predicate to determine whether an outcome result triggers a fast retry.

class

HedgingStrategyOptions<TResult>

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class HedgingStrategyOptions<TResult> : ResilienceStrategyOptions
Hereda de: ResilienceStrategyOptions

Defines configuration options for strongly-typed parallel speculative hedging.

Notas:

Parallel hedging executes concurrent speculative attempts if the primary execution does not complete within `Delay`. WARNING: Hedging must only be configured for safe, idempotent, and side-effect-free operations (such as read-only queries). Type parameters: TResult: The type of value returned by the hedged operation.

Miembros (7)

  • constructorHedgingStrategyOptions
    public HedgingStrategyOptions()

    Initializes a new instance of the `HedgingStrategyOptions<TResult>` class with default settings.

  • propertyDelay
    public TimeSpan Delay { get; set; }

    Gets or sets the delay duration before spawning the next hedged execution attempt. Default is 500 milliseconds.

  • propertyHedgedActionGenerator
    public Func<HedgingContext, Func<ValueTask<TResult>>?>? HedgedActionGenerator { get; set; }

    Gets or sets an optional custom delegate generator providing secondary speculative tasks (e.g. hitting alternate replicas).

  • propertyMaxHedgedAttempts
    public int MaxHedgedAttempts { get; set; }

    Gets or sets the maximum number of additional concurrent hedged attempts allowed. Default is 2 attempts.

  • propertyOnHedging
    public Func<HedgingContext, ValueTask>? OnHedging { get; set; }

    Gets or sets an optional asynchronous callback invoked when a hedged attempt is initiated.

  • propertyShouldHandleException
    public Func<Exception, bool>? ShouldHandleException { get; set; }

    Gets or sets an optional predicate to determine whether an exception triggers a fast hedge without waiting for delay.

  • propertyShouldHandleResult
    public Func<TResult, bool>? ShouldHandleResult { get; set; }

    Gets or sets an optional predicate to determine whether an outcome result triggers a fast hedge.

class

RateLimiterContext

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class RateLimiterContext

Provides context information when an execution is rejected by rate limiting constraints.

Miembros (3)

  • constructorRateLimiterContext
    public RateLimiterContext(ResilienceContext resilienceContext, TimeSpan? retryAfter = null)

    Initializes a new instance of the `RateLimiterContext` class.

    resilienceContext: ResilienceContext
    The active execution context.
    retryAfter: TimeSpan?
    The duration to wait before trying again, if calculated.

    Exceptions: ArgumentNullException: `resilienceContext` is `null`

  • propertyResilienceContext
    public ResilienceContext ResilienceContext { get; }

    Gets the execution context.

  • propertyRetryAfter
    public TimeSpan? RetryAfter { get; }

    Gets the duration to wait before trying again, if provided by the rate limiter.

class

RateLimiterStrategyOptions

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class RateLimiterStrategyOptions : ResilienceStrategyOptions
Hereda de: ResilienceStrategyOptions

Defines configuration options for the rate limiter resilience strategy.

Miembros (7)

  • constructorRateLimiterStrategyOptions
    public RateLimiterStrategyOptions()

    Initializes a new instance of the `RateLimiterStrategyOptions` class with default settings.

  • propertyCustomRateLimiter
    public System.Threading.RateLimiting.RateLimiter? CustomRateLimiter { get; set; }

    Gets or sets a custom `RateLimiting.RateLimiter` instance. When provided, this limiter overrides `LimiterType` and other parameters.

  • propertyLimiterType
    public RateLimiterType LimiterType { get; set; }

    Gets or sets the rate limiter algorithm type. Default is `RateLimiterType.SlidingWindow`.

  • propertyOnRejected
    public Func<RateLimiterContext, ValueTask>? OnRejected { get; set; }

    Gets or sets an asynchronous callback invoked when an execution is rejected by the rate limiter.

  • propertyPermitLimit
    public int PermitLimit { get; set; }

    Gets or sets the maximum number of permits allowed within the given window. Default is 100 permits.

  • propertyQueueLimit
    public int QueueLimit { get; set; }

    Gets or sets the maximum number of requests that can be queued waiting for a permit. Default is 0 (no queueing; immediate rejection if limit exceeded).

  • propertyWindow
    public TimeSpan Window { get; set; }

    Gets or sets the replenishment time window. Default is 1 minute.

enum

RateLimiterType

Ensamblado: EricksonLopez.Resilience.Abstractions
public enum RateLimiterType

Specifies the type of rate limiting algorithm used by the rate limiter strategy.

Miembros (4)

  • fieldConcurrency
    Concurrency = 3

    Limits the maximum number of concurrent executions active simultaneously.

  • fieldFixedWindow
    FixedWindow = 1

    Resets all permits at the start of each fixed time interval.

  • fieldSlidingWindow
    SlidingWindow = 0

    Divides the window into segments and smooths permit replenishment across sliding intervals.

  • fieldTokenBucket
    TokenBucket = 2

    Replenishes permits steadily into a token bucket up to a maximum capacity.

class

ResilienceStrategyOptions

Ensamblado: EricksonLopez.Resilience.Abstractions
public abstract class ResilienceStrategyOptions

Represents the abstract base class for resilience strategy configuration options.

Miembros (2)

  • propertyName
    public string? Name { get; set; }

    Gets or sets the optional custom identifier for this strategy instance within a pipeline.

  • propertyOrder
    public int Order { get; set; }

    Gets or sets the execution order priority of the strategy within a multi-strategy pipeline (lower numbers execute first).

class

RetryAttemptContext

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class RetryAttemptContext

Provides context information when a retry attempt is triggered by a resilience strategy.

Miembros (6)

  • constructorRetryAttemptContext
    public RetryAttemptContext(ResilienceContext resilienceContext, int attemptNumber, TimeSpan delay, Exception? exception = null, object? result = null)

    Initializes a new instance of the `RetryAttemptContext` class.

    resilienceContext: ResilienceContext
    The active execution context.
    attemptNumber: int
    The zero-based or one-based attempt number that just failed.
    delay: TimeSpan
    The computed delay before the next retry attempt.
    exception: Exception?
    The exception that triggered the retry, if any.
    result: object?
    The outcome result object that triggered the retry, if any.

    Exceptions: ArgumentNullException: `resilienceContext` is `null`

  • propertyAttemptNumber
    public int AttemptNumber { get; }

    Gets the attempt index that triggered the retry.

  • propertyDelay
    public TimeSpan Delay { get; }

    Gets the duration to wait before executing the next attempt.

  • propertyException
    public Exception? Exception { get; }

    Gets the exception that caused the failure, if an exception occurred.

  • propertyResilienceContext
    public ResilienceContext ResilienceContext { get; }

    Gets the execution context associated with this retry attempt.

  • propertyResult
    public object? Result { get; }

    Gets the result object that caused the retry, if failure was determined by result evaluation.

class

RetryStrategyOptions

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class RetryStrategyOptions : ResilienceStrategyOptions
Hereda de: ResilienceStrategyOptions

Defines configuration options for the retry resilience strategy.

Miembros (8)

  • constructorRetryStrategyOptions
    public RetryStrategyOptions()

    Initializes a new instance of the `RetryStrategyOptions` class with default settings.

  • propertyBackoffType
    public BackoffType BackoffType { get; set; }

    Gets or sets the backoff algorithm used to compute delay between consecutive retry attempts. Default is `BackoffType.ExponentialWithJitter`.

  • propertyDelay
    public TimeSpan Delay { get; set; }

    Gets or sets the base delay between retry attempts. Default is 2 seconds.

  • propertyMaxDelay
    public TimeSpan? MaxDelay { get; set; }

    Gets or sets the maximum allowed delay cap when backoff increases. If `null`, no upper limit is enforced.

  • propertyMaxRetryAttempts
    public int MaxRetryAttempts { get; set; }

    Gets or sets the maximum number of retry attempts allowed before failing the execution. Default is 3 attempts.

  • propertyOnRetry
    public Func<RetryAttemptContext, ValueTask>? OnRetry { get; set; }

    Gets or sets an asynchronous callback invoked prior to waiting and executing the next retry attempt.

  • propertyShouldHandleException
    public Func<Exception, bool>? ShouldHandleException { get; set; }

    Gets or sets an optional predicate to determine whether an observed exception should trigger a retry attempt.

  • propertyShouldHandleResult
    public Func<object?, bool>? ShouldHandleResult { get; set; }

    Gets or sets an optional predicate to determine whether an observed result value should trigger a retry attempt.

class

TimeoutContext

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class TimeoutContext

Provides context information when an operation execution exceeds the configured timeout duration.

Miembros (3)

  • constructorTimeoutContext
    public TimeoutContext(ResilienceContext resilienceContext, TimeSpan timeout)

    Initializes a new instance of the `TimeoutContext` class.

    resilienceContext: ResilienceContext
    The active execution context.
    timeout: TimeSpan
    The configured timeout duration that was exceeded.

    Exceptions: ArgumentNullException: `resilienceContext` is `null`

  • propertyResilienceContext
    public ResilienceContext ResilienceContext { get; }

    Gets the resilience execution context.

  • propertyTimeout
    public TimeSpan Timeout { get; }

    Gets the timeout duration that was exceeded.

class

TimeoutStrategyOptions

Ensamblado: EricksonLopez.Resilience.Abstractions
public sealed class TimeoutStrategyOptions : ResilienceStrategyOptions
Hereda de: ResilienceStrategyOptions

Defines configuration options for the timeout resilience strategy.

Notas:

The timeout strategy relies on cooperative cancellation via `Threading.CancellationToken`. Operations executed inside a timeout pipeline must observe and forward the provided `Threading.CancellationToken` to underlying asynchronous I/O calls so that timed-out executions terminate promptly without leaving background work running.

Miembros (3)

  • constructorTimeoutStrategyOptions
    public TimeoutStrategyOptions()

    Initializes a new instance of the `TimeoutStrategyOptions` class with default settings.

  • propertyOnTimeout
    public Func<TimeoutContext, ValueTask>? OnTimeout { get; set; }

    Gets or sets an asynchronous callback invoked when an operation execution times out.

  • propertyTimeout
    public TimeSpan Timeout { get; set; }

    Gets or sets the maximum execution duration permitted before cancelling the operation and throwing a `Exceptions.ResilienceTimeoutException`. Default is 30 seconds.

EricksonLopez.Resilience.Pipelines#

2
class

PassthroughResiliencePipeline

Ensamblado: EricksonLopez.Resilience
public sealed class PassthroughResiliencePipeline : IResiliencePipeline
Implementa: IResiliencePipeline

Represents a fallback resilience pipeline that executes delegates directly without additional strategy interceptors.

Miembros (7)

  • constructorPassthroughResiliencePipeline
    public PassthroughResiliencePipeline(string name)

    Initializes a new instance of the `PassthroughResiliencePipeline` class.

    name: string
    The name of the pipeline.
  • methodExecuteAsync
    public ValueTask ExecuteAsync(Func<CancellationToken, ValueTask> operation, CancellationToken cancellationToken = default)

    Executes an asynchronous action without a return value within this resilience pipeline.

    operation: Func<CancellationToken, ValueTask>
    The asynchronous action accepting a cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation.

    Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` is `null`

  • methodExecuteAsync
    public ValueTask ExecuteAsync(Func<ResilienceContext, ValueTask> operation, ResilienceContext context, CancellationToken cancellationToken = default)

    Executes an asynchronous action without a return value within this resilience pipeline using the specified context.

    operation: Func<ResilienceContext, ValueTask>
    The asynchronous action to execute.
    context: ResilienceContext
    The resilience context carrying execution metadata and cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation.

    Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` or `context` is `null`

  • methodExecuteAsync<TResult>
    public ValueTask<TResult> ExecuteAsync<TResult>(Func<CancellationToken, ValueTask<TResult>> operation, CancellationToken cancellationToken = default)

    Executes an asynchronous operation that returns a value within this resilience pipeline.

    operation: Func<CancellationToken, ValueTask<TResult>>
    The asynchronous operation accepting a cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation. The task result contains the value produced by `operation`.

    Type parameters: TResult: The return type of the operation. Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` is `null`

  • methodExecuteAsync<TResult>
    public ValueTask<TResult> ExecuteAsync<TResult>(Func<ResilienceContext, ValueTask<TResult>> operation, ResilienceContext context, CancellationToken cancellationToken = default)

    Executes an asynchronous operation that returns a value within this resilience pipeline using the specified context.

    operation: Func<ResilienceContext, ValueTask<TResult>>
    The asynchronous operation to execute.
    context: ResilienceContext
    The resilience context carrying execution metadata and cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation. The task result contains the value produced by `operation`.

    Type parameters: TResult: The return type of the operation. Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` or `context` is `null`

  • propertyInstance
    public static PassthroughResiliencePipeline Instance { get; }

    Gets a shared singleton `PassthroughResiliencePipeline` instance with name `"passthrough"`.

    Use this instance in unit test suites to bypass all resilience strategy evaluation and execute delegates directly, enabling deterministic testing without retry, circuit breaker, or timeout interference.

  • propertyName
    public string Name { get; }

    Gets the name of the pipeline.

class

PassthroughResiliencePipeline<TResult>

Ensamblado: EricksonLopez.Resilience
public sealed class PassthroughResiliencePipeline<TResult> : IResiliencePipeline<TResult>
Implementa: IResiliencePipeline<TResult>

Represents a fallback typed resilience pipeline that executes delegates directly without additional strategy interceptors.

Notas:

Type parameters: TResult: The type of value returned by the operation.

Miembros (4)

  • constructorPassthroughResiliencePipeline
    public PassthroughResiliencePipeline(string name)

    Initializes a new instance of the `PassthroughResiliencePipeline<TResult>` class.

    name: string
    The name of the pipeline.

    For unit testing, construct a named instance directly: `new PassthroughResiliencePipeline<TResult>("test")`. For untyped pipelines, use `PassthroughResiliencePipeline.Instance` instead.

  • methodExecuteAsync
    public ValueTask<TResult> ExecuteAsync(Func<CancellationToken, ValueTask<TResult>> operation, CancellationToken cancellationToken = default)

    Executes an asynchronous action without a return value within this resilience pipeline.

    operation: Func<CancellationToken, ValueTask<TResult>>
    The asynchronous action accepting a cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation.

    Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` is `null`

  • methodExecuteAsync
    public ValueTask<TResult> ExecuteAsync(Func<ResilienceContext, ValueTask<TResult>> operation, ResilienceContext context, CancellationToken cancellationToken = default)

    Executes an asynchronous action without a return value within this resilience pipeline using the specified context.

    operation: Func<ResilienceContext, ValueTask<TResult>>
    The asynchronous action to execute.
    context: ResilienceContext
    The resilience context carrying execution metadata and cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation.

    Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` or `context` is `null`

  • propertyName
    public string Name { get; }

    Gets the name of the pipeline.

EricksonLopez.Resilience.Policies#

2
interface

IResiliencePolicy

Ensamblado: EricksonLopez.Resilience.Abstractions
public interface IResiliencePolicy

Defines a strongly-typed, reusable resilience policy definition within the EricksonLopez ecosystem.

Miembros (2)

  • methodConfigure
    void Configure(IResiliencePipelineBuilder builder)

    Configures the resilience strategies within the provided pipeline builder.

    builder: IResiliencePipelineBuilder
    The resilience pipeline builder.
  • propertyName
    string Name { get; }

    Gets the unique logical name of the resilience policy.

class

ResiliencePolicy

Ensamblado: EricksonLopez.Resilience.Abstractions
public abstract class ResiliencePolicy : IResiliencePolicy
Implementa: IResiliencePolicy

Provides an abstract base class for defining typed resilience policies independent of underlying execution engines.

Miembros (2)

  • methodConfigure
    public abstract void Configure(IResiliencePipelineBuilder builder)

    Configures the resilience strategies within the provided pipeline builder.

    builder: IResiliencePipelineBuilder
    The resilience pipeline builder.
  • propertyName
    public abstract string Name { get; }

    Gets the unique logical name of the resilience policy.

EricksonLopez.Resilience.Polly.Adapters#

4
class

PollyContextAdapter

Ensamblado: EricksonLopez.Resilience.Polly
public static class PollyContextAdapter

Provides adapter methods to bridge `ResilienceContext` from the EricksonLopez ecosystem into Polly v8 `global::Polly.ResilienceContext`.

Miembros (3)

  • methodGetEcosystemContext
    public static ResilienceContext? GetEcosystemContext(global::Polly.ResilienceContext pollyContext)

    Extracts the ecosystem `ResilienceContext` from a Polly execution context, if present.

    pollyContext: global::Polly.ResilienceContext
    The Polly context.

    Retorna: The original ecosystem context, or `null` if not found.

    Exceptions: ArgumentNullException: `pollyContext` is `null`

  • methodReturn
    public static void Return(global::Polly.ResilienceContext pollyContext)

    Returns a pooled Polly context back to the shared pool.

    pollyContext: global::Polly.ResilienceContext
    The Polly context to return. If `null`, the method is a no-op.

    This method is null-safe: passing `null` performs no operation and does not throw. Callers may pass the value returned by `ToPollyContext` directly without a null check, as that method may return `null` when no matching context is found.

  • methodToPollyContext
    public static global::Polly.ResilienceContext ToPollyContext(ResilienceContext ecosystemContext)

    Creates a Polly `global::Polly.ResilienceContext` wrapping the specified ecosystem context.

    ecosystemContext: ResilienceContext
    The ecosystem resilience context.

    Retorna: A new Polly context instance.

    Exceptions: ArgumentNullException: `ecosystemContext` is `null`

class

PollyResilienceExecutor

Ensamblado: EricksonLopez.Resilience.Polly
public sealed class PollyResilienceExecutor : IResilienceExecutor
Implementa: IResilienceExecutor

Provides an `IResilienceExecutor` implementation that resolves configured resilience pipelines from `IResiliencePipelineRegistry`, dispatches executions through Polly-backed pipelines, and records OpenTelemetry telemetry and structured logging.

Miembros (5)

  • constructorPollyResilienceExecutor
    public PollyResilienceExecutor(IResiliencePipelineRegistry registry, ILogger<PollyResilienceExecutor>? logger = null)

    Initializes a new instance of the `PollyResilienceExecutor` class.

    registry: IResiliencePipelineRegistry
    The resilience pipeline registry used to resolve pipelines by name.
    logger: ILogger<PollyResilienceExecutor>?
    An optional structured logger instance.

    Exceptions: ArgumentNullException: `registry` is `null`

  • methodExecuteAsync
    public ValueTask ExecuteAsync(string policyName, Func<CancellationToken, ValueTask> operation, CancellationToken cancellationToken = default)

    Executes an asynchronous action without a return value under the specified resilience policy.

    policyName: string
    The name of the registered resilience policy to apply.
    operation: Func<CancellationToken, ValueTask>
    The asynchronous action accepting a cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation.

    Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; Exceptions.ResiliencePolicyNotFoundException: No policy was registered under the specified `policyName`; ArgumentNullException: `operation` is `null`; ArgumentException: `policyName` is `null` or whitespace

  • methodExecuteAsync
    public async ValueTask ExecuteAsync(string policyName, Func<ResilienceContext, ValueTask> operation, ResilienceContext context, CancellationToken cancellationToken = default)

    Executes an asynchronous action without a return value under the specified resilience policy using an explicit context.

    policyName: string
    The name of the registered resilience policy to apply.
    operation: Func<ResilienceContext, ValueTask>
    The asynchronous action accepting the execution context.
    context: ResilienceContext
    The resilience context containing metadata and telemetry context.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation.

    Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; Exceptions.ResiliencePolicyNotFoundException: No policy was registered under the specified `policyName`; ArgumentNullException: `operation` or `context` is `null`; ArgumentException: `policyName` is `null` or whitespace

  • methodExecuteAsync<TResult>
    public ValueTask<TResult> ExecuteAsync<TResult>(string policyName, Func<CancellationToken, ValueTask<TResult>> operation, CancellationToken cancellationToken = default)

    Executes an asynchronous operation that yields a value under the specified resilience policy.

    policyName: string
    The name of the registered resilience policy to apply.
    operation: Func<CancellationToken, ValueTask<TResult>>
    The asynchronous operation accepting a cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation. The task result contains the value produced by `operation`.

    Type parameters: TResult: The return type of the operation. Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; Exceptions.ResiliencePolicyNotFoundException: No policy was registered under the specified `policyName`; ArgumentNullException: `operation` is `null`; ArgumentException: `policyName` is `null` or whitespace

  • methodExecuteAsync<TResult>
    public async ValueTask<TResult> ExecuteAsync<TResult>(string policyName, Func<ResilienceContext, ValueTask<TResult>> operation, ResilienceContext context, CancellationToken cancellationToken = default)

    Executes an asynchronous operation that yields a value under the specified resilience policy using an explicit context.

    policyName: string
    The name of the registered resilience policy to apply.
    operation: Func<ResilienceContext, ValueTask<TResult>>
    The asynchronous operation accepting the execution context.
    context: ResilienceContext
    The resilience context containing metadata and telemetry context.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation. The task result contains the value produced by `operation`.

    Type parameters: TResult: The return type of the operation. Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; Exceptions.ResiliencePolicyNotFoundException: No policy was registered under the specified `policyName`; ArgumentNullException: `operation` or `context` is `null`; ArgumentException: `policyName` is `null` or whitespace

class

PollyResiliencePipeline

Ensamblado: EricksonLopez.Resilience.Polly
public sealed class PollyResiliencePipeline : IResiliencePipeline
Implementa: IResiliencePipeline

Provides an `IResiliencePipeline` implementation backed by a compiled Polly v8 `global::Polly.ResiliencePipeline`.

Miembros (9)

  • constructorPollyResiliencePipeline
    public PollyResiliencePipeline(string name, global::Polly.ResiliencePipeline pipeline)

    Initializes a new instance of the `PollyResiliencePipeline` class.

    name: string
    The unique name of the pipeline.
    pipeline: global::Polly.ResiliencePipeline
    The compiled Polly resilience pipeline.

    Exceptions: ArgumentException: `name` is `null` or whitespace; ArgumentNullException: `pipeline` is `null`

  • constructorPollyResiliencePipeline
    public PollyResiliencePipeline(string name, global::Polly.ResiliencePipeline pipeline, IReadOnlyList<IDisposable>? disposables)

    Initializes a new instance of the `PollyResiliencePipeline` class with tracked disposables.

    name: string
    The unique name of the pipeline.
    pipeline: global::Polly.ResiliencePipeline
    The compiled Polly resilience pipeline.
    disposables: IReadOnlyList<IDisposable>?
    The collection of underlying disposable resources managed by this pipeline.

    Exceptions: ArgumentException: `name` is `null` or whitespace; ArgumentNullException: `pipeline` is `null`

  • methodDispose
    public void Dispose()

    Inherits documentation from base type or interface.

  • methodDisposeAsync
    public async ValueTask DisposeAsync()

    Inherits documentation from base type or interface.

  • methodExecuteAsync
    public ValueTask ExecuteAsync(Func<CancellationToken, ValueTask> operation, CancellationToken cancellationToken = default)

    Executes an asynchronous action without a return value within this resilience pipeline.

    operation: Func<CancellationToken, ValueTask>
    The asynchronous action accepting a cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation.

    Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` is `null`

  • methodExecuteAsync
    public ValueTask ExecuteAsync(Func<ResilienceContext, ValueTask> operation, ResilienceContext context, CancellationToken cancellationToken = default)

    Executes an asynchronous action without a return value within this resilience pipeline using the specified context.

    operation: Func<ResilienceContext, ValueTask>
    The asynchronous action to execute.
    context: ResilienceContext
    The resilience context carrying execution metadata and cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation.

    Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` or `context` is `null`

  • methodExecuteAsync<TResult>
    public ValueTask<TResult> ExecuteAsync<TResult>(Func<CancellationToken, ValueTask<TResult>> operation, CancellationToken cancellationToken = default)

    Executes an asynchronous operation that returns a value within this resilience pipeline.

    operation: Func<CancellationToken, ValueTask<TResult>>
    The asynchronous operation accepting a cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation. The task result contains the value produced by `operation`.

    Type parameters: TResult: The return type of the operation. Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` is `null`

  • methodExecuteAsync<TResult>
    public ValueTask<TResult> ExecuteAsync<TResult>(Func<ResilienceContext, ValueTask<TResult>> operation, ResilienceContext context, CancellationToken cancellationToken = default)

    Executes an asynchronous operation that returns a value within this resilience pipeline using the specified context.

    operation: Func<ResilienceContext, ValueTask<TResult>>
    The asynchronous operation to execute.
    context: ResilienceContext
    The resilience context carrying execution metadata and cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation. The task result contains the value produced by `operation`.

    Type parameters: TResult: The return type of the operation. Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` or `context` is `null`

  • propertyName
    public string Name { get; }

    Gets the unique logical name of the resilience pipeline.

class

PollyResiliencePipeline<TResult>

Ensamblado: EricksonLopez.Resilience.Polly
public sealed class PollyResiliencePipeline<TResult> : IResiliencePipeline<TResult>
Implementa: IResiliencePipeline<TResult>

Provides an `IResiliencePipeline<TResult>` implementation backed by a compiled Polly v8 `global::Polly.ResiliencePipeline<TResult>`.

Notas:

Type parameters: TResult: The result type of operations executed by this pipeline.

Miembros (7)

  • constructorPollyResiliencePipeline
    public PollyResiliencePipeline(string name, global::Polly.ResiliencePipeline<TResult> pipeline)

    Initializes a new instance of the `PollyResiliencePipeline<TResult>` class.

    name: string
    The unique name of the pipeline.
    pipeline: global::Polly.ResiliencePipeline<TResult>
    The compiled Polly typed resilience pipeline.

    Exceptions: ArgumentException: `name` is `null` or whitespace; ArgumentNullException: `pipeline` is `null`

  • constructorPollyResiliencePipeline
    public PollyResiliencePipeline(string name, global::Polly.ResiliencePipeline<TResult> pipeline, IReadOnlyList<IDisposable>? disposables)

    Initializes a new instance of the `PollyResiliencePipeline<TResult>` class with tracked disposables.

    name: string
    The unique name of the pipeline.
    pipeline: global::Polly.ResiliencePipeline<TResult>
    The compiled Polly typed resilience pipeline.
    disposables: IReadOnlyList<IDisposable>?
    The collection of underlying disposable resources managed by this pipeline.

    Exceptions: ArgumentException: `name` is `null` or whitespace; ArgumentNullException: `pipeline` is `null`

  • methodDispose
    public void Dispose()

    Inherits documentation from base type or interface.

  • methodDisposeAsync
    public async ValueTask DisposeAsync()

    Inherits documentation from base type or interface.

  • methodExecuteAsync
    public ValueTask<TResult> ExecuteAsync(Func<CancellationToken, ValueTask<TResult>> operation, CancellationToken cancellationToken = default)

    Executes an asynchronous action without a return value within this resilience pipeline.

    operation: Func<CancellationToken, ValueTask<TResult>>
    The asynchronous action accepting a cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation.

    Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` is `null`

  • methodExecuteAsync
    public ValueTask<TResult> ExecuteAsync(Func<ResilienceContext, ValueTask<TResult>> operation, ResilienceContext context, CancellationToken cancellationToken = default)

    Executes an asynchronous action without a return value within this resilience pipeline using the specified context.

    operation: Func<ResilienceContext, ValueTask<TResult>>
    The asynchronous action to execute.
    context: ResilienceContext
    The resilience context carrying execution metadata and cancellation token.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Retorna: A value task representing the asynchronous operation.

    Exceptions: Exceptions.CircuitBrokenException: The circuit breaker rejected the operation because the circuit is open; Exceptions.ResilienceTimeoutException: The operation timed out according to the configured timeout limit; Exceptions.RateLimitRejectedException: The rate limiter rejected the operation due to limit exhaustion; ArgumentNullException: `operation` or `context` is `null`

  • propertyName
    public string Name { get; }

    Gets the unique logical name of the resilience pipeline.

EricksonLopez.Resilience.Polly.Builders#

1
class

PollyPipelineBuilderTranslator

Ensamblado: EricksonLopez.Resilience.Polly
public static class PollyPipelineBuilderTranslator

Provides methods to translate ecosystem resilience strategies into Polly v8 `global::Polly.ResiliencePipeline` instances.

Miembros (2)

  • methodTranslateAndBuild
    public static IResiliencePipeline TranslateAndBuild(IResiliencePipelineBuilder builder)

    Translates an ecosystem `IResiliencePipelineBuilder` into a compiled `IResiliencePipeline` backed by Polly.

    builder: IResiliencePipelineBuilder
    The ecosystem builder containing configured strategies.

    Retorna: A new `PollyResiliencePipeline` wrapping the Polly pipeline.

    Exceptions: ArgumentNullException: `builder` is `null`

  • methodTranslateAndBuild<TResult>
    public static IResiliencePipeline<TResult> TranslateAndBuild<TResult>(EcoBuilder.ResiliencePipelineBuilder<TResult> builder)

    Translates a strongly-typed `EcoBuilder.ResiliencePipelineBuilder<TResult>` into a compiled `IResiliencePipeline<TResult>` backed by Polly.

    builder: EcoBuilder.ResiliencePipelineBuilder<TResult>
    The typed ecosystem builder containing configured strategies.

    Retorna: A new `PollyResiliencePipeline<TResult>` wrapping the Polly typed pipeline.

    Type parameters: TResult: The result type of the pipeline. Exceptions: ArgumentNullException: `builder` is `null`

EricksonLopez.Resilience.Polly.Registration#

1
class

PollyResilienceRegistration

Ensamblado: EricksonLopez.Resilience.Polly
public static class PollyResilienceRegistration

Provides methods for registering the Polly execution engine as the active pipeline compilation provider for `ResiliencePipelineBuilder`.

Miembros (2)

  • methodInitialize
    public static void Initialize()

    Initializes and configures Polly as the default resilience execution adapter for the ecosystem.

  • methodRegisterTypedPipeline<TResult>
    public static void RegisterTypedPipeline<TResult>()

    Registers Polly as the compiler for typed pipelines returning `TResult`.

    Type parameters: TResult: The result type of the pipeline.

EricksonLopez.Resilience.Registry#

2
class

ResiliencePipelineRegistry

Ensamblado: EricksonLopez.Resilience
public sealed class ResiliencePipelineRegistry : IResiliencePipelineRegistry, IDisposable, IAsyncDisposable
Implementa: IAsyncDisposable, IDisposable, IResiliencePipelineRegistry

Represents a thread-safe in-memory registry holding compiled `IResiliencePipeline` instances indexed by policy name.

Miembros (9)

  • constructorResiliencePipelineRegistry
    public ResiliencePipelineRegistry()

    Initializes a new instance of the `ResiliencePipelineRegistry` class.

  • methodDispose
    public void Dispose()

    Inherits documentation from base type or interface.

  • methodDisposeAsync
    public async ValueTask DisposeAsync()

    Inherits documentation from base type or interface.

  • methodGetPipeline
    public IResiliencePipeline GetPipeline(string policyName)

    Retrieves a compiled resilience pipeline associated with the specified policy name.

    policyName: string
    The unique name of the policy.

    Retorna: The resolved `IResiliencePipeline` instance.

    Exceptions: Exceptions.ResiliencePolicyNotFoundException: No pipeline is registered under the specified policy name

  • methodGetPipeline<TResult>
    public IResiliencePipeline<TResult> GetPipeline<TResult>(string policyName)

    Retrieves a typed resilience pipeline associated with the specified policy name.

    policyName: string
    The unique name of the policy.

    Retorna: The resolved `IResiliencePipeline<TResult>` instance.

    Type parameters: TResult: The expected result type of the pipeline. Exceptions: Exceptions.ResiliencePolicyNotFoundException: No typed pipeline is registered under the specified policy name

  • methodRegister
    public ResiliencePipelineRegistry Register(string policyName, IResiliencePipeline pipeline)

    Registers a compiled resilience pipeline under the specified policy name.

    policyName: string
    The unique policy name.
    pipeline: IResiliencePipeline
    The compiled resilience pipeline instance.

    Retorna: The registry instance for chaining.

    Exceptions: ArgumentException: `policyName` is `null` or whitespace; ArgumentNullException: `pipeline` is `null`

  • methodRegister<TResult>
    public ResiliencePipelineRegistry Register<TResult>(string policyName, IResiliencePipeline<TResult> pipeline)

    Registers a compiled typed resilience pipeline under the specified policy name.

    policyName: string
    The unique policy name.
    pipeline: IResiliencePipeline<TResult>
    The compiled typed resilience pipeline instance.

    Retorna: The registry instance for chaining.

    Type parameters: TResult: The result type of the pipeline. Exceptions: ArgumentException: `policyName` is `null` or whitespace; ArgumentNullException: `pipeline` is `null`

  • methodTryGetPipeline
    public bool TryGetPipeline(string policyName, out IResiliencePipeline? pipeline)

    Attempts to retrieve a compiled resilience pipeline associated with the specified policy name.

    policyName: string
    The unique name of the policy.
    pipeline: out IResiliencePipeline?
    When this method returns, contains the pipeline if found; otherwise, `null`.

    Retorna: `true` if the pipeline exists; otherwise, `false`.

  • methodTryGetPipeline<TResult>
    public bool TryGetPipeline<TResult>(string policyName, out IResiliencePipeline<TResult>? pipeline)

    Attempts to retrieve a typed resilience pipeline associated with the specified policy name.

    policyName: string
    The unique name of the policy.
    pipeline: out IResiliencePipeline<TResult>?
    When this method returns, contains the typed pipeline if found; otherwise, `null`.

    Retorna: `true` if the typed pipeline exists; otherwise, `false`.

    Type parameters: TResult: The expected result type of the pipeline.

class

ResiliencePolicyRegistry

Ensamblado: EricksonLopez.Resilience
public sealed class ResiliencePolicyRegistry

Represents a registry holding declarative `IResiliencePolicy` definitions before they are compiled into runtime pipelines.

Miembros (4)

  • constructorResiliencePolicyRegistry
    public ResiliencePolicyRegistry()

    Initializes a new instance of the `ResiliencePolicyRegistry` class.

  • methodRegister
    public ResiliencePolicyRegistry Register(IResiliencePolicy policy)

    Registers a policy definition in the registry.

    policy: IResiliencePolicy
    The policy instance to register.

    Retorna: The policy registry instance for chaining.

    Exceptions: ArgumentNullException: `policy` is `null`; ArgumentException: The name of `policy` is `null` or whitespace

  • methodTryGetPolicy
    public bool TryGetPolicy(string policyName, out IResiliencePolicy? policy)

    Attempts to retrieve a registered policy definition by its name.

    policyName: string
    The name of the policy.
    policy: out IResiliencePolicy?
    When this method returns, contains the policy if found; otherwise, `null`.

    Retorna: `true` if the policy exists; otherwise, `false`.

    Exceptions: ArgumentException: `policyName` is `null` or whitespace

  • propertyPolicies
    public IReadOnlyCollection<IResiliencePolicy> Policies { get; }

    Gets all registered policy definitions.

Buscar en el Ecosistema EricksonLopez.*

Escribe el nombre de una librería, ID de paquete NuGet, tipo .NET o concepto arquitectónico para buscar en el portal.