Table of Contents

Interface IBulkheadPolicy

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

Bulkhead isolation policy to prevent resource exhaustion.

public interface IBulkheadPolicy
Extension Methods

Properties

HasCapacity

Gets a value indicating whether the bulkhead has available capacity.

bool HasCapacity { get; }

Property Value

bool

true when capacity remains; otherwise, false.

Methods

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

Executes an operation that observes both caller cancellation and its execution timeout.

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

Parameters

operation Func<CancellationToken, Task<T>>

The operation, which must observe the supplied strategy token.

cancellationToken CancellationToken

The caller cancellation token.

Returns

Task<T>

The operation result.

Type Parameters

T

The result type.

Remarks

Existing implementations retain the original overload and may implement this capability explicitly.

Exceptions

NotSupportedException

The implementation does not support token-aware execution.

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

Executes an operation with bulkhead isolation.

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

Parameters

operation Func<Task<T>>

The delegate to execute within the bulkhead constraints.

cancellationToken CancellationToken

A token used to observe cancellation requests.

Returns

Task<T>

A task that completes with the asynchronous result produced by the operation.

Type Parameters

T

The type returned by the asynchronous operation.

GetMetrics()

Gets the current bulkhead metrics.

BulkheadMetrics GetMetrics()

Returns

BulkheadMetrics

The current BulkheadMetrics snapshot.