Skip to content

CircuitBreaker

Alex edited this page Apr 13, 2021 · 3 revisions

Enabled by default

The circuit breaker works by looking at a rolling window of errors, and if we get above the configured failureThreshold we open the circuit for durationMilliseconds until we allow to try again.

CircuitBreakers are cached by the CommandKey, meaning using the same CommandKey will give you the same CircuitBreaker which can be beneficial if you have multiple commands for the same dependency.

Configuration - defaults

CommandConfiguration.CreateConfiguration(
config =>
{
    config.CircuitBreakerSettings = new CircuitBreakerSettings(
      isEnabled: true, 
      failureThreshhold: 0.5, 
      samplingDurationMilliseconds: 10000, 
      minimumThroughput: 20, 
      durationMiliseconds: 5000);
});
Clone this wiki locally