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
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum integral digits for circuit breaker attempts validation. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionReturns the maximum number of retry attempts.Returns the delay between retry attempts.Returns the exception types to exclude, which defaults to none.Returns the exception types to include, which defaults to all.The maximum overall delay for an operation to complete until the Circuit state is set toCircuitState.OPEN.Returns the multiplier to use to calculate the delay between retries.Class<? extends RetryPredicate> Returns the retry predicate class to use instead ofRetryable.includes()andRetryable.excludes().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_ATTEMPTSThe maximum integral digits for circuit breaker attempts validation.- See Also:
-
-
Element Details
-
includes
-
excludes
-
attempts
-
delay
Returns the delay between retry attempts.- 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 ofRetryable.includes()andRetryable.excludes().- 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
-