Closed eatgrass closed 3 years ago
I could be wrong but I think the two are slightly different.
A operation can be considered slow by setting slowCallDurationThreshold
and the operation is still given the opportunity to complete. Once the slowCallRateThreshold
is surpassed the circuit breaker will be tripped and calls will no longer be made.
The TimeLimiter
stops the operation and returns once the TimeLimiter
is surpassed.
@ryanjbaxter thanks for the explanation
and I think there should be a way to customize the CircuitBreaker through slowCallDurationThreshold
.
You can customize that using Resilience4JConfigBuilder.circuitBreakerConfig
@Bean
public Customizer<Resilience4JCircuitBreakerFactory> defaultCustomizer() {
return factory -> factory.configureDefault(id -> new Resilience4JConfigBuilder(id)
.timeLimiterConfig(TimeLimiterConfig.custom().timeoutDuration(Duration.ofSeconds(4)).build())
.circuitBreakerConfig(CircuitBreakerConfig.ofDefaults())
.build());
}
just wondering why
Resilience4JCircuitBreakerConfiguration
takes 'TimeLimiterConfig' to determine timeout, why not usingslowCallRateThreshold
inCircuitBreakerConfig
?