@Configurer public class Resilience4jConfigurationProperties extends Object
| Constructor and Description |
|---|
Resilience4jConfigurationProperties(MainConfigurationProperties parent) |
| Modifier and Type | Method and Description |
|---|---|
MainConfigurationProperties |
end() |
Boolean |
getAutomaticTransitionFromOpenToHalfOpenEnabled() |
Boolean |
getBulkheadEnabled() |
Integer |
getBulkheadMaxConcurrentCalls() |
Integer |
getBulkheadMaxWaitDuration() |
String |
getCircuitBreakerRef() |
String |
getConfigRef() |
Float |
getFailureRateThreshold() |
Integer |
getMinimumNumberOfCalls() |
Integer |
getPermittedNumberOfCallsInHalfOpenState() |
Integer |
getSlidingWindowSize() |
String |
getSlidingWindowType() |
Integer |
getSlowCallDurationThreshold() |
Float |
getSlowCallRateThreshold() |
Boolean |
getTimeoutCancelRunningFuture() |
Integer |
getTimeoutDuration() |
Boolean |
getTimeoutEnabled() |
String |
getTimeoutExecutorServiceRef() |
Integer |
getWaitDurationInOpenState() |
Boolean |
getWritableStackTraceEnabled() |
void |
setAutomaticTransitionFromOpenToHalfOpenEnabled(Boolean automaticTransitionFromOpenToHalfOpenEnabled)
Enables automatic transition from OPEN to HALF_OPEN state once the waitDurationInOpenState has passed.
|
void |
setBulkheadEnabled(Boolean bulkheadEnabled)
Whether bulkhead is enabled or not on the circuit breaker.
|
void |
setBulkheadMaxConcurrentCalls(Integer bulkheadMaxConcurrentCalls)
Configures the max amount of concurrent calls the bulkhead will support.
|
void |
setBulkheadMaxWaitDuration(Integer bulkheadMaxWaitDuration)
Configures a maximum amount of time which the calling thread will wait to enter the bulkhead.
|
void |
setCircuitBreakerRef(String circuitBreakerRef)
Refers to an existing io.github.resilience4j.circuitbreaker.CircuitBreaker instance
to lookup and use from the registry.
|
void |
setConfigRef(String configRef)
Refers to an existing io.github.resilience4j.circuitbreaker.CircuitBreakerConfig instance
to lookup and use from the registry.
|
void |
setFailureRateThreshold(Float failureRateThreshold)
Configures the failure rate threshold in percentage.
|
void |
setMinimumNumberOfCalls(Integer minimumNumberOfCalls)
Configures configures the minimum number of calls which are required (per sliding window period) before the CircuitBreaker can calculate the error rate.
|
void |
setPermittedNumberOfCallsInHalfOpenState(Integer permittedNumberOfCallsInHalfOpenState)
Configures the number of permitted calls when the CircuitBreaker is half open.
|
void |
setSlidingWindowSize(Integer slidingWindowSize)
Configures the size of the sliding window which is used to record the outcome of calls when the CircuitBreaker is closed.
|
void |
setSlidingWindowType(String slidingWindowType)
Configures the type of the sliding window which is used to record the outcome of calls when the CircuitBreaker is closed.
|
void |
setSlowCallDurationThreshold(Integer slowCallDurationThreshold)
Configures the duration threshold (seconds) above which calls are considered as slow and increase the slow calls percentage.
|
void |
setSlowCallRateThreshold(Float slowCallRateThreshold)
Configures a threshold in percentage.
|
void |
setTimeoutCancelRunningFuture(Boolean timeoutCancelRunningFuture)
Configures whether cancel is called on the running future.
|
void |
setTimeoutDuration(Integer timeoutDuration)
Configures the thread execution timeout (millis).
|
void |
setTimeoutEnabled(Boolean timeoutEnabled)
Whether timeout is enabled or not on the circuit breaker.
|
void |
setTimeoutExecutorServiceRef(String timeoutExecutorServiceRef)
References to a custom thread pool to use when timeout is enabled (uses
ForkJoinPool.commonPool() by default) |
void |
setWaitDurationInOpenState(Integer waitDurationInOpenState)
Configures the wait duration (in seconds) which specifies how long the CircuitBreaker should stay open, before it switches to half open.
|
void |
setWritableStackTraceEnabled(Boolean writableStackTraceEnabled)
Enables writable stack traces.
|
Resilience4jConfigurationProperties |
withAutomaticTransitionFromOpenToHalfOpenEnabled(Boolean automaticTransitionFromOpenToHalfOpenEnabled) |
Resilience4jConfigurationProperties |
withBulkheadEnabled(Boolean bulkheadEnabled)
Whether bulkhead is enabled or not on the circuit breaker.
|
Resilience4jConfigurationProperties |
withBulkheadMaxConcurrentCalls(Integer bulkheadMaxConcurrentCalls)
Configures the max amount of concurrent calls the bulkhead will support.
|
Resilience4jConfigurationProperties |
withBulkheadMaxWaitDuration(Integer bulkheadMaxWaitDuration)
Configures a maximum amount of time which the calling thread will wait to enter the bulkhead.
|
Resilience4jConfigurationProperties |
withCircuitBreakerRef(String circuitBreakerRef)
Refers to an existing io.github.resilience4j.circuitbreaker.CircuitBreaker instance
to lookup and use from the registry.
|
Resilience4jConfigurationProperties |
withConfigRef(String configRef)
Refers to an existing io.github.resilience4j.circuitbreaker.CircuitBreakerConfig instance
to lookup and use from the registry.
|
Resilience4jConfigurationProperties |
withFailureRateThreshold(Float failureRateThreshold)
Configures the failure rate threshold in percentage.
|
Resilience4jConfigurationProperties |
withMinimumNumberOfCalls(Integer minimumNumberOfCalls)
Configures configures the minimum number of calls which are required (per sliding window period) before the CircuitBreaker can calculate the error rate.
|
Resilience4jConfigurationProperties |
withPermittedNumberOfCallsInHalfOpenState(Integer permittedNumberOfCallsInHalfOpenState)
Configures the number of permitted calls when the CircuitBreaker is half open.
|
Resilience4jConfigurationProperties |
withSlidingWindowSize(Integer slidingWindowSize)
Configures the size of the sliding window which is used to record the outcome of calls when the CircuitBreaker is closed.
|
Resilience4jConfigurationProperties |
withSlidingWindowType(String slidingWindowType)
Configures the type of the sliding window which is used to record the outcome of calls when the CircuitBreaker is closed.
|
Resilience4jConfigurationProperties |
withSlowCallDurationThreshold(Integer slowCallDurationThreshold)
Configures the duration threshold (seconds) above which calls are considered as slow and increase the slow calls percentage.
|
Resilience4jConfigurationProperties |
withSlowCallRateThreshold(Float slowCallRateThreshold)
Configures a threshold in percentage.
|
Resilience4jConfigurationProperties |
withTimeoutCancelRunningFuture(Boolean timeoutCancelRunningFuture)
Configures whether cancel is called on the running future.
|
Resilience4jConfigurationProperties |
withTimeoutDuration(Integer timeoutDuration)
Configures the thread execution timeout (millis).
|
Resilience4jConfigurationProperties |
withTimeoutEnabled(Boolean timeoutEnabled)
Whether timeout is enabled or not on the circuit breaker.
|
Resilience4jConfigurationProperties |
withTimeoutExecutorServiceRef(String timeoutExecutorServiceRef)
References to a custom thread pool to use when timeout is enabled (uses
ForkJoinPool.commonPool() by default) |
Resilience4jConfigurationProperties |
withWaitDurationInOpenState(Integer waitDurationInOpenState)
Configures the wait duration (in seconds) which specifies how long the CircuitBreaker should stay open, before it switches to half open.
|
Resilience4jConfigurationProperties |
withWritableStackTraceEnabled(Boolean writableStackTraceEnabled)
Enables writable stack traces.
|
public Resilience4jConfigurationProperties(MainConfigurationProperties parent)
public MainConfigurationProperties end()
public String getCircuitBreakerRef()
public void setCircuitBreakerRef(String circuitBreakerRef)
public String getConfigRef()
public void setConfigRef(String configRef)
public Float getFailureRateThreshold()
public void setFailureRateThreshold(Float failureRateThreshold)
The threshold must be greater than 0 and not greater than 100. Default value is 50 percentage.
public Integer getPermittedNumberOfCallsInHalfOpenState()
public void setPermittedNumberOfCallsInHalfOpenState(Integer permittedNumberOfCallsInHalfOpenState)
The size must be greater than 0. Default size is 10.
public Integer getSlidingWindowSize()
public void setSlidingWindowSize(Integer 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 String getSlidingWindowType()
public void setSlidingWindowType(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 Integer getMinimumNumberOfCalls()
public void setMinimumNumberOfCalls(Integer 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 Boolean getWritableStackTraceEnabled()
public void setWritableStackTraceEnabled(Boolean writableStackTraceEnabled)
public Integer getWaitDurationInOpenState()
public void setWaitDurationInOpenState(Integer waitDurationInOpenState)
public Boolean getAutomaticTransitionFromOpenToHalfOpenEnabled()
public void setAutomaticTransitionFromOpenToHalfOpenEnabled(Boolean automaticTransitionFromOpenToHalfOpenEnabled)
public Float getSlowCallRateThreshold()
public void setSlowCallRateThreshold(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 Integer getSlowCallDurationThreshold()
public void setSlowCallDurationThreshold(Integer slowCallDurationThreshold)
public Boolean getBulkheadEnabled()
public void setBulkheadEnabled(Boolean bulkheadEnabled)
public Integer getBulkheadMaxConcurrentCalls()
public void setBulkheadMaxConcurrentCalls(Integer bulkheadMaxConcurrentCalls)
public Integer getBulkheadMaxWaitDuration()
public void setBulkheadMaxWaitDuration(Integer 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 Boolean getTimeoutEnabled()
public void setTimeoutEnabled(Boolean timeoutEnabled)
public String getTimeoutExecutorServiceRef()
public void setTimeoutExecutorServiceRef(String timeoutExecutorServiceRef)
ForkJoinPool.commonPool() by default)public Integer getTimeoutDuration()
public void setTimeoutDuration(Integer timeoutDuration)
public Boolean getTimeoutCancelRunningFuture()
public void setTimeoutCancelRunningFuture(Boolean timeoutCancelRunningFuture)
public Resilience4jConfigurationProperties withCircuitBreakerRef(String circuitBreakerRef)
public Resilience4jConfigurationProperties withConfigRef(String configRef)
public Resilience4jConfigurationProperties withFailureRateThreshold(Float failureRateThreshold)
The threshold must be greater than 0 and not greater than 100. Default value is 50 percentage.
public Resilience4jConfigurationProperties withPermittedNumberOfCallsInHalfOpenState(Integer permittedNumberOfCallsInHalfOpenState)
The size must be greater than 0. Default size is 10.
public Resilience4jConfigurationProperties withSlidingWindowSize(Integer 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 Resilience4jConfigurationProperties withSlidingWindowType(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 Resilience4jConfigurationProperties withMinimumNumberOfCalls(Integer 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 Resilience4jConfigurationProperties withWritableStackTraceEnabled(Boolean writableStackTraceEnabled)
public Resilience4jConfigurationProperties withWaitDurationInOpenState(Integer waitDurationInOpenState)
public Resilience4jConfigurationProperties withAutomaticTransitionFromOpenToHalfOpenEnabled(Boolean automaticTransitionFromOpenToHalfOpenEnabled)
public Resilience4jConfigurationProperties withSlowCallRateThreshold(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 Resilience4jConfigurationProperties withSlowCallDurationThreshold(Integer slowCallDurationThreshold)
public Resilience4jConfigurationProperties withBulkheadEnabled(Boolean bulkheadEnabled)
public Resilience4jConfigurationProperties withBulkheadMaxConcurrentCalls(Integer bulkheadMaxConcurrentCalls)
public Resilience4jConfigurationProperties withBulkheadMaxWaitDuration(Integer 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 Resilience4jConfigurationProperties withTimeoutEnabled(Boolean timeoutEnabled)
public Resilience4jConfigurationProperties withTimeoutExecutorServiceRef(String timeoutExecutorServiceRef)
ForkJoinPool.commonPool() by default)public Resilience4jConfigurationProperties withTimeoutDuration(Integer timeoutDuration)
public Resilience4jConfigurationProperties withTimeoutCancelRunningFuture(Boolean timeoutCancelRunningFuture)
Apache Camel