com.ccadllc.cedi.circuitbreaker
An Algebraic Data Type (ADT) representing the events which may be published to the fs2.Stream
by the CircuitBreaker
whenever there is a state change (a CircuitBreaker
opening or closing, or a CircuitBreaker
throttling a request, or
increasing/decreasing the rate at which a request is throttled).
An Algebraic Data Type (ADT) representing the exceptions which may be returned by a protected
program to indicate that the CircuitBreaker
itself is failing the request prior to underlying
program invocation.
This event is published whenever a CircuitBreaker
is "closed" (testing having determined the underlying program is capable of
normal invocation).
This event is published whenever a CircuitBreaker
is "closed" (testing having determined the underlying program is capable of
normal invocation).
- identifies the CircuitBreaker
which triggered this event.
- the statistics.FailureStatistics which provide details on the current state of the CircuitBreaker
.
An evaluator determines whether or not a failure of a protected program should qualify as a systemic failure
to be added to the CircuitBreaker
statistics and used to determine whether the failure threshold has been
reached and the circuit breaker should be opened.
An evaluator determines whether or not a failure of a protected program should qualify as a systemic failure
to be added to the CircuitBreaker
statistics and used to determine whether the failure threshold has been
reached and the circuit breaker should be opened. A program can fail for many reasons, including application-level
errors, and it is often not desirable to count these as failures a circuit breaker should keep track of (they
may have no bearing on errors which could cause cascading failures).
Different subsystems may look for different error or exception hierarchies in this determination (e.g., a
circuit breaker protecting a database access program may provide an evaluator that looks for
exceptions related to the API used to access the database).
Uniquely identifies a CircuitBreaker
within the CircuitBreakerRegistry.
This data type represents the error returned when the CircuitBreaker
is failing a request because the configured percentage
of failures of the protected program has exceeded the configured maximum threshold over the configured time period.
This data type represents the error returned when the CircuitBreaker
is failing a request because the configured percentage
of failures of the protected program has exceeded the configured maximum threshold over the configured time period.
- identifies the CircuitBreaker
which triggered this error.
- the statistics.FailureStatistics which provide details on the current state of the CircuitBreaker
.
This event is published whenever a CircuitBreaker
is "opened" (causing subsequent requests to fail fast excepting for periodic tests).
This event is published whenever a CircuitBreaker
is "opened" (causing subsequent requests to fail fast excepting for periodic tests).
- identifies the CircuitBreaker
which triggered this event.
- the statistics.FailureStatistics which provide details on the current state of the CircuitBreaker
.
This event is published whenever a CircuitBreaker
is throttling down requests.
This event is published whenever a CircuitBreaker
is throttling down requests. This means that the acceptable inbound rate
has lowered based on observation that the processing rate for the program has degraded.
- identifies the CircuitBreaker
which triggered this event.
- the statistics.FlowControlStatistics which provide details on the current state of the CircuitBreaker
.
This data type represents the error returned when the CircuitBreaker
is failing a request as a means of throttling
the input rate to bring it down to the average observed rate at which the underlying program can process them or
to a configured hard limit.
This data type represents the error returned when the CircuitBreaker
is failing a request as a means of throttling
the input rate to bring it down to the average observed rate at which the underlying program can process them or
to a configured hard limit.
- identifies the CircuitBreaker
which triggered this error.
- the statistics.FlowControlStatistics which provide details on the current state of the CircuitBreaker
.
This event is published whenever a CircuitBreaker
is throttling up requests.
This event is published whenever a CircuitBreaker
is throttling up requests. This means that the acceptable inbound rate
has risen based on observation that the processing rate has decreased/improved.
- identifies the CircuitBreaker
which triggered this event.
- the statistics.FlowControlStatistics which provide details on the current state of the CircuitBreaker
.
The FailureEvaluator
companion object, providing smart constructor and a default evaluator.
Smart constructor, normally not called directly but rather by the CircuitBreakerRegistry to create
a CircuitBreaker
instance which protects against cascading failure.
Smart constructor, normally not called directly but rather by the CircuitBreakerRegistry to create
a CircuitBreaker
instance which protects against cascading failure.
- uniquely identifies a CircuitBreaker
instance within the CircuitBreakerRegistry.
- the FailureSettings configuration for the CircuitBreaker
.
- the FailureEvaluator to use for the CircuitBreaker
, used to determine what
program errors should be used to determine state changes.
- the function to call in order to publish an event - the CircuitBreakerRegistry,
for instance, provides a function which takes the event and returns an effectful program that when run
will publish to an fs2.Stream
which interested clients can subscribe to.
circuitBreaker - an effectful program that when run will return an instance of a failure
CircuitBreaker
.
Smart constructor, normally not called directly but rather by the CircuitBreakerRegistry to create a
CircuitBreaker
instance which protects against both cascading failure and system overload.
Smart constructor, normally not called directly but rather by the CircuitBreakerRegistry to create a
CircuitBreaker
instance which protects against both cascading failure and system overload.
- uniquely identifies a CircuitBreaker
instance within the CircuitBreakerRegistry.
- the FlowControlSettings configuration for the CircuitBreaker
.
- the FailureEvaluator to use for the CircuitBreaker
, used to determine what program
errors should be used to determine state changes.
- the function to call in order to publish an event - the CircuitBreakerRegistry,
for instance, provides a function which takes the event and returns an effectful program that when run
will publish to an fs2.Stream
which interested clients can subscribe to.
circuitBreaker - an effectful program that when run will return an instance of a flow control
CircuitBreaker
.
The companion object for a
CircuitBreaker
instance. The smart constructors for creation of failure and flow controlCircuitBreaker
instances live here, as do common data types used byCircuitBreaker
instances.