com.ccadllc.cedi.circuitbreaker
A description of the current statistics.Statistics for this CircuitBreaker
.
A description of the current statistics.Statistics for this CircuitBreaker
.
statistics - an effectful program that when run returns the current
Statistics
for this circuitbreaker.
A description of the date/time that this CircuitBreaker
was last active (that is, the last time
its protect
function was invoked).
A description of the date/time that this CircuitBreaker
was last active (that is, the last time
its protect
function was invoked).
lastActivity - an effectful program that when run returns the java.time.Instant
this
circuitbreaker was last active.
- the unique identifier for this circuit breaker.
- the unique identifier for this circuit breaker. This is used to look up the
CircuitBreaker
instance from the registry (or, if not present, to create a new instance).
Provides protection over the provided effectful program based on the configuration
of this
instance.
Provides protection over the provided effectful program based on the configuration
of this
instance.
- the result type of the effectful program.
- the effectful program represented by F[A]
.
program - an enhanced version of the passed-in program, wrapped in a protective layer that will fail fast when a threshold of failures have been observed for the underlying service and may also throttle requests when the observed inbound rate exceeds the processing rate.
The library's main abstraction, representing protection of an effectful program. The API is relatively simple, consisting of one primary function,
protect
, which takes the program to protect and returns that an enhanced version of that program having the ability to fail fast without invoking the underlying service if conditions warrant, ensuring failure of the service it represents does not result in a cascade of failure. TheCircuitBreaker
has two secondary functions: 1.)currentStatistics
, which provides the current statistics.Statistics for use by monitoring and dashboarding applications and; 2.)lastActivity
which provides thejava.time.Instant
timestamp indicating the instant theCircuitBreaker
was last active.The
CircuitBreaker
is not generally directly instantiated; rather, aCircuitBreaker
is requested from the CircuitBreakerRegistry via the CircuitBreakerRegistry#forFailure function which provides a variant that trips/opens given a configured percentage of protected program failures within a configured time period or via the CircuitBreakerRegistry#forFlowControl function which provides a variant that, in addition to the failure protected just described, also throttles requests when the average rate of requests over a configured time period is greater than the observed average rate of processing for the protected program.- the type of effectful program.