Table of Contents

Interface IDistributedCircuitBreaker

Namespace
Excalibur.Dispatch.Resilience.Polly
Assembly
Excalibur.Dispatch.Resilience.Polly.dll

Distributed circuit breaker for coordinating state across multiple instances.

public interface IDistributedCircuitBreaker
Extension Methods

Methods

ExecuteAsync<T>(Func<Task<T>>, CancellationToken)

Executes an operation with distributed circuit breaker protection.

Task<T> ExecuteAsync<T>(Func<Task<T>> operation, CancellationToken cancellationToken)

Parameters

operation Func<Task<T>>

The operation to execute within the circuit breaker.

cancellationToken CancellationToken

A token that is observed for cancellation.

Returns

Task<T>

A task that completes with the asynchronous result.

Type Parameters

T

The type returned by the asynchronous operation.

GetStateAsync(CancellationToken)

Gets the current state of the circuit breaker.

Task<CircuitState> GetStateAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A token that is observed for cancellation.

Returns

Task<CircuitState>

A task that completes with the distributed circuit state.

RecordFailureAsync(CancellationToken, Exception?)

Records a failure in the distributed state.

Task RecordFailureAsync(CancellationToken cancellationToken, Exception? exception = null)

Parameters

cancellationToken CancellationToken

A token that is observed for cancellation.

exception Exception

The exception being evaluated.

Returns

Task

A task that completes when the update is persisted.

RecordSuccessAsync(CancellationToken)

Records a success in the distributed state.

Task RecordSuccessAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A token that is observed for cancellation.

Returns

Task

A task that completes when the update is persisted.

ResetAsync(CancellationToken)

Resets the circuit breaker across all instances.

Task ResetAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task representing the reset operation.