UsingCircuitBreaker
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.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Value members
Abstract methods
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.
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
The configuration for the circuit breaker:
The configuration for the circuit breaker:
serviceName- the name of the servicenumberOfCallsToTriggerStateChange- 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 failuresunstablePeriodDuration- the time in seconds that failure counts are accumulated. When the period ends without reaching the limit, the counter switches back to 0.
Attributes
Concrete methods
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.
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
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.
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
Concrete fields
The CircuitBreaker instance used by this trait.
The CircuitBreaker instance used by this trait.