CircuitBreakerPluginConfigBuilder
Builder for configuring the KresilCircuitBreakerPlugin.
Properties
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
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 a predicate to record the response of a call. The predicate should return true
if the response is to be considered a failure; false
otherwise.
Determines whether to record as failure the server responses with status codes in the range of 500..599.
Configures the sliding window used to record calls and calculate the failure rate.