Class PollyResilienceAdapterOptions
- Namespace
- Excalibur.Dispatch.Resilience.Polly
- Assembly
- Excalibur.Dispatch.Resilience.Polly.dll
Configuration options for Polly resilience adapters registered via
AddPollyResilienceAdapters() extension methods.
public sealed class PollyResilienceAdapterOptions
- Inheritance
-
PollyResilienceAdapterOptions
- Inherited Members
- Extension Methods
Remarks
This options class allows consumers to configure all Polly adapter settings in one place
when calling AddPollyResilienceAdapters().
Example usage:
services.AddDispatch()
.AddPollyResilienceAdapters(options =>
{
options.RetryOptions = new PollyRetryOptions
{
MaxAttempts = 5,
BaseDelay = TimeSpan.FromMilliseconds(100),
BackoffStrategy = BackoffStrategy.Exponential,
UseJitter = true
};
options.CircuitBreakerOptions = new CircuitBreakerOptions
{
ConsecutiveFailureThreshold = 5,
BreakDuration = TimeSpan.FromSeconds(30)
};
});
Properties
CircuitBreakerOptions
Gets or sets the circuit breaker options for PollyCircuitBreakerPolicyAdapter and PollyTransportCircuitBreakerRegistry.
public CircuitBreakerOptions? CircuitBreakerOptions { get; set; }
Property Value
Remarks
If not set, default values from CircuitBreakerOptions will be used.
EnableTelemetry
Gets or sets whether to enable Polly telemetry integration.
public bool EnableTelemetry { get; set; }
Property Value
Remarks
When enabled, Polly will emit telemetry events that can be collected by OpenTelemetry or other monitoring systems.
MaxBackoffDelay
Gets or sets the maximum delay cap for backoff calculations.
public TimeSpan MaxBackoffDelay { get; set; }
Property Value
Remarks
This caps the maximum delay returned by Excalibur.Dispatch.Resilience.Polly.PollyBackoffCalculatorAdapter regardless of the calculated exponential delay.
RetryOptions
Gets or sets the retry policy options for PollyRetryPolicyAdapter and Excalibur.Dispatch.Resilience.Polly.PollyBackoffCalculatorAdapter.
public PollyRetryOptions? RetryOptions { get; set; }
Property Value
Remarks
If not set, default values from PollyRetryOptions will be used.