trait UsingCircuitBreaker extends AnyRef
Trait to be mixed in to services or connectors that wish to protect their outgoing calls from wasting unsuccessful invocations in periods where the service seems to be unavailable.
- Alphabetic
- By Inheritance
- UsingCircuitBreaker
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def breakOnException(t: Throwable): Boolean
Predicate that defines the exceptions that should be treated as a failure.
Predicate that defines the exceptions that should be treated as a failure. In most cases only 5xx status responses should be treated as a server-side issue.
- Attributes
- protected
- abstract def circuitBreakerConfig: CircuitBreakerConfig
The configuration for the circuit breaker:
The configuration for the circuit breaker:
-
serviceName- the name of the service -numberOfCallsToTriggerStateChange- the number of failed calls that need to accumulate withinunstablePeriodDurationfor the service to get disabled, as well as the number of successful calls that are needed to get a service back from the disabled state to normal. -unavailablePeriodDuration- the time in seconds that a service should be disabled in case it accumulated more than the configured maximum number of failures -unstablePeriodDuration- the time in seconds that failure counts are accumulated. When the period ends without reaching the limit, the counter switches back to 0.- Attributes
- protected
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- lazy val circuitBreaker: CircuitBreaker
The
CircuitBreakerinstance used by this trait.The
CircuitBreakerinstance used by this trait.- Attributes
- protected
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isServiceAvailable: Boolean
Indicates whether the service is available.
Indicates whether the service is available. Returns
falseif the service is disabled due to accumulating too many failures in the configured time frame. Note that due to the asynchronous nature of the circuit breaker, you can still get anUnhealthyServiceExceptionafter this method returnedtrueas the state might change any time.- Attributes
- protected
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withCircuitBreaker[T](f: => Future[T])(implicit hc: HeaderCarrier): Future[T]
Protects the specified future from being evaluated in case the service is disabled due to accumulating too many failures in the configured time frame.
Protects the specified future from being evaluated in case the service is disabled due to accumulating too many failures in the configured time frame. If the service is disabled, the future will fail with a
UnhealthyServiceException, if it is enabled, it will succeed or fail with whatever result the original future produces.- Attributes
- protected
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)