uk.gov.hmrc.circuitbreaker

# UsingCircuitBreaker

###
Related Doc: package circuitbreaker

#### 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.

Linear Supertypes
AnyRef, Any
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. UsingCircuitBreaker
2. AnyRef
3. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Abstract Value Members

1. #### 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

2. #### 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 within `unstablePeriodDuration` for 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

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

   Definition Classes
     AnyRef → Any

2. #### final def ##(): Int

   Definition Classes
     AnyRef → Any

3. #### final def ==(arg0: Any): Boolean

   Definition Classes
     AnyRef → Any

4. #### final def asInstanceOf[T0]: T0

   Definition Classes
     Any

5. #### lazy val circuitBreaker: CircuitBreaker

   The `CircuitBreaker` instance used by this trait.

   The `CircuitBreaker` instance used by this trait.

   Attributes
     protected

6. #### def clone(): AnyRef

   Attributes
     protected[java.lang]
   Definition Classes
     AnyRef
   Annotations
     @throws( ... )

7. #### final def eq(arg0: AnyRef): Boolean

   Definition Classes
     AnyRef

8. #### def equals(arg0: Any): Boolean

   Definition Classes
     AnyRef → Any

9. #### def finalize(): Unit

   Attributes
     protected[java.lang]
   Definition Classes
     AnyRef
   Annotations
     @throws( classOf[java.lang.Throwable] )

10. #### final def getClass(): Class[_]

    Definition Classes
      AnyRef → Any

11. #### def hashCode(): Int

    Definition Classes
      AnyRef → Any

12. #### final def isInstanceOf[T0]: Boolean

    Definition Classes
      Any

13. #### def isServiceAvailable: Boolean

    Indicates whether the service is available.

    Indicates whether the service is available. Returns `false` if 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 an `UnhealthyServiceException` after this method returned `true` as the state might change any time.

    Attributes
      protected

14. #### final def ne(arg0: AnyRef): Boolean

    Definition Classes
      AnyRef

15. #### final def notify(): Unit

    Definition Classes
      AnyRef

16. #### final def notifyAll(): Unit

    Definition Classes
      AnyRef

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

    Definition Classes
      AnyRef

18. #### def toString(): String

    Definition Classes
      AnyRef → Any

19. #### final def wait(): Unit

    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

20. #### final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

21. #### final def wait(arg0: Long): Unit

    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

22. #### 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

### Inherited from AnyRef

### Inherited from Any

### Ungrouped