CircuitBreakerConfigBuilder
Builder for configuring a CircuitBreakerConfig instance. Use circuitBreakerConfig to create one.
Properties
The base configuration object to be used as a starting point for building the final configuration object.
Configures the rate in percentage (e.g., 0.5 for 50%) of calls recorded as failure that will trigger the circuit breaker to transition to the Open state, if equalled or exceeded.
Configures the maximum duration the circuit breaker will wait in the HalfOpen state before transitioning to the Open state automatically. If set to Duration.ZERO
, the circuit breaker will wait indefinitely in the HalfOpen state until permittedNumberOfCallsInHalfOpenState is reached.
Configures the number of calls that are allowed to be made in the HalfOpen state. If this number is exceeded, further calls will be rejected. If maxWaitDurationInHalfOpenState is set to Duration.ZERO
, the circuit breaker will wait indefinitely in the HalfOpen state until the permitted number of calls is reached.
Functions
Builds the final configuration object after applying possible modifications to the base configuration.
Configures the circuit breaker delay strategy to use a custom delay provider between transitions from Open to HalfOpen. In contrast to customDelayInOpenState, this method enables caller control over the delay provider (which is the kotlinx.coroutines.delay by default) and optional additional state between transitions. See DelayProvider for more information.
Configures the predicate that determines whether an exception should be recorded as a failure, and as such, increase the failure rate.
Configures the predicate that determines whether a result of an operation should be recorded as a failure, and as such, increase the failure rate.
Configures the sliding window used to record calls and calculate the failure rate.