@Target(value={METHOD,TYPE}) @Retention(value=RUNTIME) @Documented @Retryable(stateful=true) public @interface CircuitBreaker
Modifier and Type | Optional Element and Description |
---|---|
String |
exceptionExpression
Specify an expression to be evaluated after the
SimpleRetryPolicy.canRetry() returns true - can be used to conditionally
suppress the retry. |
Class<? extends Throwable>[] |
exclude
Exception types that are not retryable.
|
Class<? extends Throwable>[] |
include
Exception types that are retryable.
|
String |
label
A unique label for the circuit for reporting and state management.
|
int |
maxAttempts |
String |
maxAttemptsExpression |
long |
openTimeout
When
maxAttempts() failures are reached within this timeout, the circuit
is opened automatically, preventing access to the downstream component. |
String |
openTimeoutExpression
When
maxAttempts() failures are reached within this timeout, the circuit
is opened automatically, preventing access to the downstream component. |
long |
resetTimeout
If the circuit is open for longer than this timeout then it resets on the next call
to give the downstream component a chance to respond again.
|
String |
resetTimeoutExpression
If the circuit is open for longer than this timeout then it resets on the next call
to give the downstream component a chance to respond again.
|
Class<? extends Throwable>[] |
value
Exception types that are retryable.
|
public abstract Class<? extends Throwable>[] exclude
public abstract int maxAttempts
public abstract String maxAttemptsExpression
maxAttempts()
.public abstract String label
public abstract long resetTimeout
public abstract String resetTimeoutExpression
resetTimeout()
.public abstract long openTimeout
maxAttempts()
failures are reached within this timeout, the circuit
is opened automatically, preventing access to the downstream component.public abstract String openTimeoutExpression
maxAttempts()
failures are reached within this timeout, the circuit
is opened automatically, preventing access to the downstream component. Overrides
openTimeout()
.public abstract String exceptionExpression
SimpleRetryPolicy.canRetry()
returns true - can be used to conditionally
suppress the retry. Only invoked after an exception is thrown. The root object for
the evaluation is the last Throwable
. Other beans in the context can be
referenced. For example:
"message.contains('you can retry this')"
.
and
"@someBean.shouldRetry(#root)"
.
Copyright © 2021 SpringSource. All rights reserved.