Package io.micronaut.retry.annotation
Annotation Type CircuitBreaker
-
@Documented @Retention(RUNTIME) @Target({METHOD,TYPE,ANNOTATION_TYPE}) @Retryable public @interface CircuitBreaker
Variation ofRetryable
that implements the Circuit Breaker pattern. Has higher overhead thanRetryable
as aCircuitState
has to be maintained for each method call- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Fields Description static int
MAX_RETRY_ATTEMPTS
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description @Digits(integer=4,fraction=0) java.lang.String
attempts
java.lang.String
delay
java.lang.Class<? extends java.lang.Throwable>[]
excludes
java.lang.Class<? extends java.lang.Throwable>[]
includes
java.lang.String
maxDelay
The maximum overall delay for an operation to complete until the Circuit state is set toCircuitState.OPEN
.@Digits(integer=2,fraction=2) java.lang.String
multiplier
java.lang.Class<? extends RetryPredicate>
predicate
java.lang.String
reset
Sets theDuration
of time before resetting the circuit toCircuitState.HALF_OPEN
allowing a single retry.boolean
throwWrappedException
Iftrue
and the circuit is opened, it throws the original exception wrapped.
-
-
-
Element Detail
-
includes
@AliasFor(annotation=Retryable.class, member="includes") java.lang.Class<? extends java.lang.Throwable>[] includes
- Returns:
- The exception types to include (defaults to all)
- Default:
- {}
-
-
-
excludes
@AliasFor(annotation=Retryable.class, member="excludes") java.lang.Class<? extends java.lang.Throwable>[] 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) java.lang.String attempts
- Returns:
- The maximum number of retry attempts
- Default:
- "3"
-
-
-
delay
@AliasFor(annotation=Retryable.class, member="delay") java.lang.String 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) java.lang.String multiplier
- Returns:
- The multiplier to use to calculate the delay between retries.
- Default:
- "0"
-
-
-
maxDelay
@AliasFor(annotation=Retryable.class, member="maxDelay") java.lang.String 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
java.lang.String reset
Sets theDuration
of time before resetting the circuit toCircuitState.HALF_OPEN
allowing a single retry.- Returns:
- The
Duration
of time before reset
- Default:
- "20s"
-
-
-
predicate
@AliasFor(annotation=Retryable.class, member="predicate") java.lang.Class<? extends RetryPredicate> 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 throwWrappedException
Iftrue
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
-
-