Interface ITransportCircuitBreakerRegistry
- Namespace
- Excalibur.Dispatch.Resilience
- Assembly
- Excalibur.Dispatch.dll
Registry for managing circuit breaker instances per transport.
public interface ITransportCircuitBreakerRegistry
- Extension Methods
Remarks
This registry ensures each transport has its own isolated circuit breaker, preventing failures in one transport from affecting others.
Diagnostic and admin operations (Count, Remove, ResetAll, GetAllStates, GetTransportNames) are kept off this interface so an implementation is not obliged to carry them. Test the registry instance for ITransportCircuitBreakerDiagnostics to reach them.
Transport names are matched without regard to case, using ordinal comparison. "Kafka", "kafka" and "KAFKA" name one transport and share one circuit. An implementation that distinguishes them gives the same transport two breakers, so each observes only the calls that used its spelling — and a transport failing every call can stay below its configured threshold on both and never open.
Methods
GetOrCreate(string)
Gets or creates a circuit breaker for the specified transport using default options.
ICircuitBreakerPolicy GetOrCreate(string transportName)
Parameters
transportNamestringThe name of the transport (e.g., "RabbitMQ", "AzureServiceBus").
Returns
- ICircuitBreakerPolicy
The circuit breaker policy for the transport.
Exceptions
- ArgumentNullException
transportNameis null.- ArgumentException
transportNameis empty or consists only of white-space characters.
GetOrCreate(string, CircuitBreakerOptions)
Gets or creates a circuit breaker for the specified transport with custom options.
ICircuitBreakerPolicy GetOrCreate(string transportName, CircuitBreakerOptions options)
Parameters
transportNamestringThe name of the transport.
optionsCircuitBreakerOptionsThe circuit breaker configuration options.
Returns
- ICircuitBreakerPolicy
The circuit breaker policy for the transport.
Exceptions
- ArgumentNullException
transportNameoroptionsis null.- ArgumentException
transportNameis empty or consists only of white-space characters.
TryGet(string)
Tries to get an existing circuit breaker for the specified transport.
ICircuitBreakerPolicy? TryGet(string transportName)
Parameters
transportNamestringThe name of the transport.
Returns
- ICircuitBreakerPolicy
The circuit breaker policy if found; otherwise, null.
Exceptions
- ArgumentNullException
transportNameis null.- ArgumentException
transportNameis empty or consists only of white-space characters.