spring-cloud/spring-cloud-circuitbreaker

Issue with recordResult predicate config

Raghava2016 opened this issue · 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.

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.

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.

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.