arrow-fx-coroutines / arrow.fx.coroutines / CircuitBreaker
CircuitBreaker
class CircuitBreaker
Types
Exceptions
Constructors
Functions
awaitClose |
Awaits for this CircuitBreaker to be CircuitBreaker.State.Closed.suspend fun awaitClose(): Unit |
doOnClosed |
Returns a new circuit breaker that wraps the state of the source and that will fire the given callback upon the circuit breaker transitioning to the CircuitBreaker.Closed state.fun doOnClosed(callback: suspend () -> Unit ): CircuitBreaker |
doOnHalfOpen |
Returns a new circuit breaker that wraps the state of the source and that will fire the given callback upon the circuit breaker transitioning to the CircuitBreaker.HalfOpen state.fun doOnHalfOpen(callback: suspend () -> Unit ): CircuitBreaker |
doOnOpen |
Returns a new circuit breaker that wraps the state of the source and that will fire the given callback upon the circuit breaker transitioning to the CircuitBreaker.Open state.fun doOnOpen(callback: suspend () -> Unit ): CircuitBreaker |
doOnRejectedTask |
Returns a new circuit breaker that wraps the state of the source and that upon a task being rejected will execute the given callback .fun doOnRejectedTask(callback: suspend () -> Unit ): CircuitBreaker |
protect |
Returns a new task that upon execution will execute the given task, but with the protection of this circuit breaker.suspend fun <A> ~~protect~~(fa: suspend () -> A): A |
protectEither |
Returns a new task that upon execution will execute the given task, but with the protection of this circuit breaker. If an exception in fa occurs, other than an ExecutionRejected exception, it will be rethrown.suspend fun <A> protectEither(fa: suspend () -> A): Either<ExecutionRejected, A> |
protectOrThrow |
Returns a new task that upon execution will execute the given task, but with the protection of this circuit breaker. If an exception in fa occurs it will be rethrowntailrec suspend fun <A> protectOrThrow(fa: suspend () -> A): A |
state |
Returns the current CircuitBreaker.State, meant for debugging purposes.suspend fun state(): State |
Companion Object Functions
of |
Attempts to create a CircuitBreaker.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 ?
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 ? 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 ? |