@Metadata(label="configuration,eip") @Configurer(extended=true) public class Resilience4jConfigurationDefinition extends Resilience4jConfigurationCommon
Constructor and Description |
---|
Resilience4jConfigurationDefinition() |
Resilience4jConfigurationDefinition(CircuitBreakerDefinition parent) |
Modifier and Type | Method and Description |
---|---|
Resilience4jConfigurationDefinition |
automaticTransitionFromOpenToHalfOpenEnabled(boolean automaticTransitionFromOpenToHalfOpenEnabled)
Enables automatic transition from OPEN to HALF_OPEN state once the waitDurationInOpenState has passed.
|
Resilience4jConfigurationDefinition |
bulkheadEnabled(boolean bulkheadEnabled)
Whether bulkhead is enabled or not on the circuit breaker.
|
Resilience4jConfigurationDefinition |
bulkheadMaxConcurrentCalls(int bulkheadMaxConcurrentCalls)
Configures the max amount of concurrent calls the bulkhead will support.
|
Resilience4jConfigurationDefinition |
bulkheadMaxWaitDuration(int bulkheadMaxWaitDuration)
Configures a maximum amount of time which the calling thread will wait to enter the bulkhead.
|
Resilience4jConfigurationDefinition |
circuitBreakerRef(String circuitBreakerRef)
Refers to an existing io.github.resilience4j.circuitbreaker.CircuitBreaker instance to lookup and use from the
registry.
|
Resilience4jConfigurationDefinition |
configRef(String ref)
Refers to an existing io.github.resilience4j.circuitbreaker.CircuitBreakerConfig instance to lookup and use from
the registry.
|
CircuitBreakerDefinition |
end()
End of configuration.
|
Resilience4jConfigurationDefinition |
failureRateThreshold(float failureRateThreshold)
Configures the failure rate threshold in percentage.
|
Resilience4jConfigurationDefinition |
minimumNumberOfCalls(int minimumNumberOfCalls)
Configures configures the minimum number of calls which are required (per sliding window period) before the
CircuitBreaker can calculate the error rate.
|
Resilience4jConfigurationDefinition |
permittedNumberOfCallsInHalfOpenState(int permittedNumberOfCallsInHalfOpenState)
Configures the number of permitted calls when the CircuitBreaker is half open.
|
Resilience4jConfigurationDefinition |
slidingWindowSize(int slidingWindowSize)
Configures the size of the sliding window which is used to record the outcome of calls when the CircuitBreaker is
closed.
|
Resilience4jConfigurationDefinition |
slidingWindowType(String slidingWindowType)
Configures the type of the sliding window which is used to record the outcome of calls when the CircuitBreaker is
closed.
|
Resilience4jConfigurationDefinition |
slowCallDurationThreshold(int slowCallDurationThreshold)
Configures the duration threshold (seconds) above which calls are considered as slow and increase the slow calls
percentage.
|
Resilience4jConfigurationDefinition |
slowCallRateThreshold(float slowCallRateThreshold)
Configures a threshold in percentage.
|
Resilience4jConfigurationDefinition |
timeoutCancelRunningFuture(boolean timeoutCancelRunningFuture)
Configures whether cancel is called on the running future.
|
Resilience4jConfigurationDefinition |
timeoutDuration(int timeoutDuration)
Configures the thread execution timeout (millis).
|
Resilience4jConfigurationDefinition |
timeoutEnabled(boolean timeoutEnabled)
Whether timeout is enabled or not on the circuit breaker.
|
Resilience4jConfigurationDefinition |
timeoutExecutorServiceRef(String executorServiceRef)
References to a custom thread pool to use when timeout is enabled (uses
ForkJoinPool.commonPool() by
default) |
Resilience4jConfigurationDefinition |
waitDurationInOpenState(int waitDurationInOpenState)
Configures the wait duration (in seconds) which specifies how long the CircuitBreaker should stay open, before it
switches to half open.
|
Resilience4jConfigurationDefinition |
writableStackTraceEnabled(boolean writableStackTraceEnabled)
Enables writable stack traces.
|
getAutomaticTransitionFromOpenToHalfOpenEnabled, getBulkheadEnabled, getBulkheadMaxConcurrentCalls, getBulkheadMaxWaitDuration, getCircuitBreakerRef, getConfigRef, getFailureRateThreshold, getMinimumNumberOfCalls, getPermittedNumberOfCallsInHalfOpenState, getSlidingWindowSize, getSlidingWindowType, getSlowCallDurationThreshold, getSlowCallRateThreshold, getTimeoutCancelRunningFuture, getTimeoutDuration, getTimeoutEnabled, getTimeoutExecutorServiceRef, getWaitDurationInOpenState, getWritableStackTraceEnabled, setAutomaticTransitionFromOpenToHalfOpenEnabled, setBulkheadEnabled, setBulkheadMaxConcurrentCalls, setBulkheadMaxWaitDuration, setCircuitBreakerRef, setConfigRef, setFailureRateThreshold, setMinimumNumberOfCalls, setPermittedNumberOfCallsInHalfOpenState, setSlidingWindowSize, setSlidingWindowType, setSlowCallDurationThreshold, setSlowCallRateThreshold, setTimeoutCancelRunningFuture, setTimeoutDuration, setTimeoutEnabled, setTimeoutExecutorServiceRef, setWaitDurationInOpenState, setWritableStackTraceEnabled
getId, setId
public Resilience4jConfigurationDefinition()
public Resilience4jConfigurationDefinition(CircuitBreakerDefinition parent)
public Resilience4jConfigurationDefinition circuitBreakerRef(String circuitBreakerRef)
public Resilience4jConfigurationDefinition configRef(String ref)
public Resilience4jConfigurationDefinition failureRateThreshold(float failureRateThreshold)
The threshold must be greater than 0 and not greater than 100. Default value is 50 percentage.
public Resilience4jConfigurationDefinition permittedNumberOfCallsInHalfOpenState(int permittedNumberOfCallsInHalfOpenState)
The size must be greater than 0. Default size is 10.
public Resilience4jConfigurationDefinition slidingWindowSize(int slidingWindowSize)
slidingWindowSize
configures the size of the sliding window. Sliding window can either be
count-based or time-based.
If slidingWindowType
is COUNT_BASED, the last slidingWindowSize
calls are recorded and
aggregated. If slidingWindowType
is TIME_BASED, the calls of the last slidingWindowSize
seconds
are recorded and aggregated.
The slidingWindowSize
must be greater than 0. The minimumNumberOfCalls
must be greater than 0. If
the slidingWindowType is COUNT_BASED, the minimumNumberOfCalls
cannot be greater than
slidingWindowSize
. If the slidingWindowType is TIME_BASED, you can pick whatever you want.
Default slidingWindowSize is 100.
public Resilience4jConfigurationDefinition slidingWindowType(String slidingWindowType)
slidingWindowType
is COUNT_BASED, the last slidingWindowSize
calls are recorded and
aggregated. If slidingWindowType
is TIME_BASED, the calls of the last slidingWindowSize
seconds
are recorded and aggregated.
Default slidingWindowType is COUNT_BASED.public Resilience4jConfigurationDefinition minimumNumberOfCalls(int minimumNumberOfCalls)
minimumNumberOfCalls
is 10, then at least 10
calls must be recorded, before the failure rate can be calculated. If only 9 calls have been recorded the
CircuitBreaker will not transition to open even if all 9 calls have failed.
Default minimumNumberOfCalls is 100public Resilience4jConfigurationDefinition writableStackTraceEnabled(boolean writableStackTraceEnabled)
public Resilience4jConfigurationDefinition waitDurationInOpenState(int waitDurationInOpenState)
public Resilience4jConfigurationDefinition automaticTransitionFromOpenToHalfOpenEnabled(boolean automaticTransitionFromOpenToHalfOpenEnabled)
public Resilience4jConfigurationDefinition slowCallRateThreshold(float slowCallRateThreshold)
The threshold must be greater than 0 and not greater than 100. Default value is 100 percentage which means that all recorded calls must be slower than slowCallDurationThreshold.
public Resilience4jConfigurationDefinition slowCallDurationThreshold(int slowCallDurationThreshold)
public Resilience4jConfigurationDefinition bulkheadEnabled(boolean bulkheadEnabled)
public Resilience4jConfigurationDefinition bulkheadMaxConcurrentCalls(int bulkheadMaxConcurrentCalls)
public Resilience4jConfigurationDefinition bulkheadMaxWaitDuration(int bulkheadMaxWaitDuration)
Note: for threads running on an event-loop or equivalent (rx computation pool, etc), setting maxWaitDuration to 0 is highly recommended. Blocking an event-loop thread will most likely have a negative effect on application throughput.
public Resilience4jConfigurationDefinition timeoutEnabled(boolean timeoutEnabled)
public Resilience4jConfigurationDefinition timeoutExecutorServiceRef(String executorServiceRef)
ForkJoinPool.commonPool()
by
default)public Resilience4jConfigurationDefinition timeoutDuration(int timeoutDuration)
public Resilience4jConfigurationDefinition timeoutCancelRunningFuture(boolean timeoutCancelRunningFuture)
public CircuitBreakerDefinition end()
Apache Camel