spring-cloud-circuitbreaker icon indicating copy to clipboard operation
spring-cloud-circuitbreaker copied to clipboard

Issue with recordResult predicate config

Open Raghava2016 opened this issue 3 years ago • 3 comments

springframework.cloud.circuitbreaker.resilience4j: 2.1.1

how do I achieve following thing?

I would like to read following properties from YML file.

resilience4j.circuitbreaker: instances: redis: failureRateThreshold: 50 minimumNumberOfCalls: 10 slidingWindowType: TIME_BASED slidingWindowSize: 10

Since it's not feasible to set recordResultPredicate in YML file, I would like to use builder to do so.

@Bean
public Customizer<ReactiveResilience4JCircuitBreakerFactory> defaultCustomizer() {
    return factory -> factory.configure(builder -> builder
        .circuitBreakerConfig(getCircuitBreakerConfig(CircuitBreakerConfig.ofDefaults())), "redis");
}

private CircuitBreakerConfig getCircuitBreakerConfig(CircuitBreakerConfig config) {
    return CircuitBreakerConfig.from(config)
        .recordResult(CustomRedisRateLimiter.recordResultPredicate())
        .build();
}

I want to CircuitBreakerConfig to have all config from YML file along with recordResultPredicate value.

I am unable to achieve it as I am not getting access to config from YML file. Please advice.

Raghava2016 avatar Aug 22 '22 17:08 Raghava2016

Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.

ryanjbaxter avatar Aug 23 '22 00:08 ryanjbaxter

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-cloud-issues avatar Aug 30 '22 00:08 spring-cloud-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

spring-cloud-issues avatar Sep 06 '22 00:09 spring-cloud-issues