spring-cloud / spring-cloud-circuitbreaker

Spring Cloud Circuit Breaker API and Implementations
Apache License 2.0
328 stars 109 forks source link

Issue with recordResult predicate config #154

Closed Raghava2016 closed 1 year ago

Raghava2016 commented 1 year ago

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.

ryanjbaxter commented 1 year ago

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.

spring-cloud-issues commented 1 year ago

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 commented 1 year ago

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.