Package io.micronaut.retry.annotation
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
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionThe maximum overall delay for an operation to complete until the Circuit state is set toCircuitState.OPEN
.Class<? extends RetryPredicate>
Sets theDuration
of time before resetting the circuit toCircuitState.HALF_OPEN
allowing a single retry.boolean
Iftrue
and the circuit is opened, it throws the original exception wrapped. -
Field Summary
-
Field Details
-
MAX_RETRY_ATTEMPTS
static final int MAX_RETRY_ATTEMPTS- See Also:
-
-
Element Details
-
includes
- Returns:
- The exception types to include (defaults to all)
- Default:
- {}
-
excludes
- Returns:
- The exception types to exclude (defaults to none)
- Default:
- {}
-
attempts
@Digits(integer=4, fraction=0) @AliasFor(annotation=Retryable.class, member="attempts") @Digits(integer=4,fraction=0) String attempts- Returns:
- The maximum number of retry attempts
- Default:
- "3"
-
delay
- Returns:
- The delay between retry attempts
- Default:
- "500ms"
-
multiplier
@Digits(integer=2, fraction=2) @AliasFor(annotation=Retryable.class, member="multiplier") @Digits(integer=2,fraction=2) String multiplier- Returns:
- The multiplier to use to calculate the delay between retries.
- Default:
- "0"
-
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 theDuration
of time before resetting the circuit toCircuitState.HALF_OPEN
allowing a single retry.- Returns:
- The
Duration
of 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 throwWrappedExceptionIftrue
and the circuit is opened, it throws the original exception wrapped. in aCircuitOpenException
- Returns:
- Whether to wrap the original exception in a
CircuitOpenException
- Default:
- false
-