CircuitBreaker

Companion:
class
class Object
trait Matchable
class Any

Type members

Classlikes

sealed trait CircuitBreakerCallError[+E]
case class CircuitBreakerException[E](error: CircuitBreakerCallError[E]) extends Exception
case object CircuitBreakerOpen extends CircuitBreakerCallError[Nothing]
object State
Companion:
class
sealed trait State
Companion:
object
case class WrappedError[E](error: E) extends CircuitBreakerCallError[E]

Value members

Concrete methods

def make[E](trippingStrategy: ZManaged[Clock, Nothing, TrippingStrategy], resetPolicy: Schedule[Clock, Any, Any], isFailure: PartialFunction[E, Boolean], onStateChange: State => UIO[Unit]): ZManaged[Clock, Nothing, CircuitBreaker[E]]

Create a CircuitBreaker with the given tripping strategy

Create a CircuitBreaker with the given tripping strategy

Value parameters:
isFailure

Only failures that match according to isFailure are treated as failures by the circuit breaker. Other failures are passed on, circumventing the circuit breaker's failure counter.

onStateChange

Observer for circuit breaker state changes

resetPolicy

Reset schedule after too many failures. Typically an exponential backoff strategy is used.

trippingStrategy

Determines under which conditions the CircuitBraker trips

def withMaxFailures[E](maxFailures: Int, resetPolicy: Schedule[Clock, Any, Any], isFailure: PartialFunction[E, Boolean], onStateChange: State => UIO[Unit]): ZManaged[Clock, Nothing, CircuitBreaker[E]]

Create a CircuitBreaker that fails when a number of successive failures (no pun intended) has been counted

Create a CircuitBreaker that fails when a number of successive failures (no pun intended) has been counted

Value parameters:
isFailure

Only failures that match according to isFailure are treated as failures by the circuit breaker. Other failures are passed on, circumventing the circuit breaker's failure counter.

maxFailures

Maximum number of failures before tripping the circuit breaker

onStateChange

Observer for circuit breaker state changes

resetPolicy

Reset schedule after too many failures. Typically an exponential backoff strategy is used.

Returns:

The CircuitBreaker as a managed resource