Annotation Interface CircuitBreaker
@Documented
@Retention(RUNTIME)
@Target({METHOD,TYPE,ANNOTATION_TYPE})
@Retryable
public @interface CircuitBreaker
Variation of
Retryable that implements the Circuit Breaker pattern. Has higher overhead than
Retryable as a CircuitState has to be maintained for each method call- Since:
- 1.0
- Author:
- graemerocher
-
Field Summary
Fields -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe maximum overall delay for an operation to complete until the Circuit state is set toCircuitState.OPEN.Class<? extends RetryPredicate> Sets theDurationof time before resetting the circuit toCircuitState.HALF_OPENallowing a single retry.booleanIftrueand the circuit is opened, it throws the original exception wrapped.
-
Field Details
-
MAX_RETRY_ATTEMPTS
static final int MAX_RETRY_ATTEMPTS- See Also:
-
-
Element Details
-
includes
-
excludes
-
attempts
-
delay
- Returns:
- The delay between retry attempts
- Default:
"500ms"
-
multiplier
-
maxDelay
The maximum overall delay for an operation to complete until the Circuit state is set toCircuitState.OPEN.- Returns:
- The maximum overall delay
- Default:
"5s"
-
reset
String resetSets theDurationof time before resetting the circuit toCircuitState.HALF_OPENallowing a single retry.- Returns:
- The
Durationof time before reset
- Default:
"20s"
-
predicate
- Returns:
- The retry predicate class to use instead of
Retryable.includes()andRetryable.excludes()(defaults to none)
- Default:
io.micronaut.retry.annotation.DefaultRetryPredicate.class
-
throwWrappedException
boolean throwWrappedExceptionIftrueand the circuit is opened, it throws the original exception wrapped. in aCircuitOpenException- Returns:
- Whether to wrap the original exception in a
CircuitOpenException
- Default:
false
-