arrow-fx-coroutines / arrow.fx.coroutines / CircuitBreaker / of

of

suspend fun of(maxFailures: Int, resetTimeoutNanos: Double, exponentialBackoffFactor: Double = 1.0, maxResetTimeout: Double = Double.POSITIVE_INFINITY, onRejected: suspend () -> Unit = suspend { Unit }, onClosed: suspend () -> Unit = suspend { Unit }, onHalfOpen: suspend () -> Unit = suspend { Unit }, onOpen: suspend () -> Unit = suspend { Unit }): CircuitBreaker?

Attempts to create a CircuitBreaker.

Parameters

maxFailures - is the maximum count for failures before opening the circuit breaker.

resetTimeoutNanos - is the timeout to wait in the Open state before attempting a close of the circuit breaker (but without the backoff factor applied) in nanoseconds.

exponentialBackoffFactor - is a factor to use for resetting the resetTimeout when in the HalfOpen state, in case the attempt to Close fails.

maxResetTimeout - is the maximum timeout the circuit breaker is allowed to use when applying the exponentialBackoffFactor.

onRejected - is a callback for signaling rejected tasks, so every time a task execution is attempted and rejected in CircuitBreaker.Open or CircuitBreaker.HalfOpen states.

onClosed - is a callback for signaling transitions to the CircuitBreaker.State.Closed state.

onHalfOpen - is a callback for signaling transitions to CircuitBreaker.State.HalfOpen.

onOpen - is a callback for signaling transitions to CircuitBreaker.State.Open.@ExperimentalTime suspend fun of(maxFailures: Int, resetTimeout: Duration, exponentialBackoffFactor: Double = 1.0, maxResetTimeout: Duration = Duration.INFINITE, onRejected: suspend () -> Unit = suspend { Unit }, onClosed: suspend () -> Unit = suspend { Unit }, onHalfOpen: suspend () -> Unit = suspend { Unit }, onOpen: suspend () -> Unit = suspend { Unit }): CircuitBreaker?

Attempts to create a CircuitBreaker.

Parameters

maxFailures - is the maximum count for failures before opening the circuit breaker.

resetTimeout - is the timeout to wait in the Open state before attempting a close of the circuit breaker (but without the backoff factor applied).

exponentialBackoffFactor - is a factor to use for resetting the resetTimeout when in the HalfOpen state, in case the attempt to Close fails.

maxResetTimeout - is the maximum timeout the circuit breaker is allowed to use when applying the exponentialBackoffFactor.

onRejected - is a callback for signaling rejected tasks, so every time a task execution is attempted and rejected in CircuitBreaker.Open or CircuitBreaker.HalfOpen states.

onClosed - is a callback for signaling transitions to the CircuitBreaker.State.Closed state.

onHalfOpen - is a callback for signaling transitions to CircuitBreaker.State.HalfOpen.

onOpen - is a callback for signaling transitions to CircuitBreaker.State.Open.suspend fun ~~of~~(maxFailures: Int, resetTimeout: Duration, exponentialBackoffFactor: Double = 1.0, maxResetTimeout: Duration = FxDuration.INFINITE, onRejected: suspend () -> Unit = suspend { Unit }, onClosed: suspend () -> Unit = suspend { Unit }, onHalfOpen: suspend () -> Unit = suspend { Unit }, onOpen: suspend () -> Unit = suspend { Unit }): CircuitBreaker? Deprecated: arrow.fx.coroutines.Duration is deprecated and will be removed in 0.13.0 in favor of kotlin.time.Duration

Do you like Arrow?

Arrow Org
<