Class CircuitBreakerPolicy.Builder
java.lang.Object
io.micronaut.retry.CircuitBreakerPolicy.Builder
- Enclosing class:
CircuitBreakerPolicy
Builder for
CircuitBreakerPolicy.- Since:
- 5.0.0
- Author:
- graemerocher
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the circuit breaker policy.capturedException(Class<? extends Throwable> capturedException) Sets the captured exception type.Sets the delay between retry attempts.Adds excluded exception types.Adds included exception types.jitter(double jitter) Sets the jitter factor.maxAttempts(int maxAttempts) Sets the maximum number of attempts.Sets the maximum overall delay.multiplier(double multiplier) Sets the delay multiplier.predicate(RetryPredicate predicate) Sets the retry predicate.resetTimeout(Duration resetTimeout) Sets the circuit reset timeout.throwWrappedException(boolean throwWrappedException) Sets whether open-circuit exceptions should be wrapped.
-
Method Details
-
maxAttempts
Sets the maximum number of attempts.- Parameters:
maxAttempts- The maximum number of attempts- Returns:
- This builder
-
delay
Sets the delay between retry attempts.- Parameters:
delay- The delay between retry attempts- Returns:
- This builder
-
maxDelay
Sets the maximum overall delay.- Parameters:
maxDelay- The maximum overall delay- Returns:
- This builder
-
multiplier
Sets the delay multiplier.- Parameters:
multiplier- The delay multiplier- Returns:
- This builder
-
jitter
Sets the jitter factor.- Parameters:
jitter- The jitter factor- Returns:
- This builder
-
predicate
Sets the retry predicate.- Parameters:
predicate- The retry predicate- Returns:
- This builder
-
capturedException
Sets the captured exception type.- Parameters:
capturedException- The captured exception type- Returns:
- This builder
-
includes
@SafeVarargs public final CircuitBreakerPolicy.Builder includes(Class<? extends Throwable>... includes) Adds included exception types.- Parameters:
includes- The included exception types- Returns:
- This builder
-
excludes
@SafeVarargs public final CircuitBreakerPolicy.Builder excludes(Class<? extends Throwable>... excludes) Adds excluded exception types.- Parameters:
excludes- The excluded exception types- Returns:
- This builder
-
resetTimeout
Sets the circuit reset timeout.- Parameters:
resetTimeout- The circuit reset timeout- Returns:
- This builder
-
throwWrappedException
Sets whether open-circuit exceptions should be wrapped.- Parameters:
throwWrappedException- Whether open-circuit exceptions should be wrapped- Returns:
- This builder
-
build
Builds the circuit breaker policy.- Returns:
- The circuit breaker policy
-