Class ChaosStrategy<T>
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
ChaosStrategyOptionsThe 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
ResilienceContextThe 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.