Reactive Circuit Breaker is a library that maintains the state of an upstream resource's health through usage of upstream services rather than using a 'health check' call.
Each 'connector' to an upstream service will need to mix in the UsingCircuitBreaker
trait and configure its behaviour through implementing all abstract members of the trait.
Every function/method that needs circuit breaker protection then wraps the actual function call (that returns a Future) with the withCircuitBreaker
method
that's available through the mixin.
An upstream service, in the context of the circuit breaker, can be in a number of finite states:
- Healthy
- Unstable
- Unavailable
- Trial
The transition between the states is based on the variables supplied to the circuit breaker for a upstream service.
When the circuit breaker for a upstream service is in the Unavailable state, all requests to that service will result in a UnhealthyServiceException returned. Note: In this occurrence, the upstream service is never called.
For configuration details see the scaladoc of this mixin.
resolvers += Resolver.typesafeRepo("releases")
libraryDependencies += "uk.gov.hmrc" %% "reactive-circuit-breaker" % "x.x.x"
- Scala 3
- Cross build of scala 2.13 introduced
- N/A
This code is open source software licensed under the Apache 2.0 License.