Trait

org.squbs.streams.circuitbreaker

CircuitBreakerState

Related Doc: package circuitbreaker

Permalink

trait CircuitBreakerState extends AnyRef

Holds the state of the circuit breaker. Transitions through three states:

Closed: elements/requests/calls run through the main logic until the maxFailures count is reached. If maxFailures is reached, it transitions to Open state.

Open: Short circuits. A scala.util.Failure or a fallback response is returned. After resetTimeout, it transitions to HalfOpen state.

HalfOpen: the first element/request/call will be allowed through the main logic, if it succeeds the circuit breaker will reset to Closed state. If it fails, the circuit breaker will re-open to Open state. All elements/requests/calls beyond the first that execute while the first is running will fail-fast with scala.util.Failure or a fallback response.

An ActorRef can be subscribed to receive certain events, e.g., TransitionEvents to receive all state transition events or specific state transition event like Open.

It collects metrics for success, failure and short-circuit counts. Also, exposes the state as a gauge.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CircuitBreakerState
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract val callTimeout: FiniteDuration

    Permalink
  2. abstract def currentState: State

    Permalink

    returns

    the current state

    Attributes
    protected
  3. abstract val exponentialBackoffFactor: Double

    Permalink
  4. abstract def fails(): Unit

    Permalink

    Implementation specific fail logic

    Implementation specific fail logic

    Attributes
    protected
  5. abstract def isShortCircuited: Boolean

    Permalink

    Implementation specific short circuit check

    Implementation specific short circuit check

    returns

    true if short circuited

    Attributes
    protected
  6. abstract val maxFailures: Int

    Permalink
  7. abstract val maxResetTimeout: FiniteDuration

    Permalink
  8. abstract val metricRegistry: MetricRegistry

    Permalink
  9. abstract val name: String

    Permalink
  10. abstract val resetTimeout: FiniteDuration

    Permalink
  11. abstract def succeeds(): Unit

    Permalink

    Implementation specific success logic

    Implementation specific success logic

    Attributes
    protected
  12. abstract def transitionImpl(fromState: State, toState: State): Boolean

    Permalink

    Implementation specific transition logic

    Implementation specific transition logic

    Attributes
    protected
  13. abstract def withMetricRegistry(metricRegistry: MetricRegistry): CircuitBreakerState

    Permalink

    The provided MetricRegistry will be used to register metrics

    The provided MetricRegistry will be used to register metrics

    metricRegistry

    the registry to use for codahale metrics

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object StateGauge extends Gauge[State]

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. final def attemptReset(): Unit

    Permalink

    Attempts to reset breaker by transitioning to HalfOpen state.

    Attempts to reset breaker by transitioning to HalfOpen state. This is valid from Open state only.

    Attributes
    protected
  7. val beanName: ObjectName

    Permalink
  8. final def checkAndMarkIfShortCircuit(): Boolean

    Permalink

    Check if circuit should be short circuited.

  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. val mBeanServer: MBeanServer

    Permalink
  17. final def markFailure(): Unit

    Permalink

    Mark a failed element/response/call through CircuitBreaker.

  18. final def markSuccess(): Unit

    Permalink

    Mark a successful element/response/call through CircuitBreaker.

  19. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  20. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. final def resetBreaker(): Unit

    Permalink

    Resets breaker to Closed state.

    Resets breaker to Closed state. This is valid from HalfOpen state only.

    Attributes
    protected
  23. def subscribe(subscriber: ActorRef, to: EventType): Boolean

    Permalink

    Subscribe an ActorRef to receive events that it's interested in.

    Subscribe an ActorRef to receive events that it's interested in.

    subscriber

    ActorRef that would receive the events

    to

    event types that this ActorRef is interested in

    returns

    true if subscription is successful

  24. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  25. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  26. final def transition(fromState: State, toState: State): Unit

    Permalink

    Implements consistent transition between states.

    Implements consistent transition between states. Throws IllegalStateException if an invalid transition is attempted.

    fromState

    State being transitioning from

    toState

    State being transitioning to

    Attributes
    protected
  27. final def tripBreaker(fromState: State): Unit

    Permalink

    Trips breaker to an open state.

    Trips breaker to an open state. This is valid from Closed or HalfOpen states.

    fromState

    State we're coming from (Closed or HalfOpen)

    Attributes
    protected
  28. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped