Table of Contents

Class ChaosStrategy<T>

Namespace
Polly.Simmy
Assembly
Polly.Core.dll

Base class for generic (reactive) chaos strategies.

public abstract class ChaosStrategy<T> : ResilienceStrategy<T>

Type Parameters

T

The type of result this strategy handles.

Inheritance
ChaosStrategy<T>
Inherited Members

Remarks

For strategies that handle all result types the generic parameter must be of type object.

Constructors

ChaosStrategy(ChaosStrategyOptions)

Initializes a new instance of the ChaosStrategy<T> class.

protected ChaosStrategy(ChaosStrategyOptions options)

Parameters

options ChaosStrategyOptions

The chaos strategy options.

Methods

ShouldInjectAsync(ResilienceContext)

Determines whether or not the chaos strategy should be injected based on the injection rate and enabled flag.

protected ValueTask<bool> ShouldInjectAsync(ResilienceContext context)

Parameters

context ResilienceContext

The ResilienceContext instance.

Returns

ValueTask<bool>

A boolean value that indicates whether or not the chaos strategy should be injected.

Remarks

Use this method before injecting any chaos strategy to evaluate whether a given chaos strategy needs to be injected during the execution.