spring-cloud / spring-cloud-circuitbreaker

Spring Cloud Circuit Breaker API and Implementations
Apache License 2.0
336 stars 110 forks source link

Resilience4j TimeLimiter configuration (and maybe CircutBreakerConfiguration) seem to be ignored when using e.g. FeignClients #178

Closed oliverfuehrer closed 10 months ago

oliverfuehrer commented 10 months ago

Resilience4j version: spring-cloud-circuitbreaker-resilience4j-3.1.0-RC1.jar Java version: openjdk version "21.0.1" 2023-10-17

I wrote a spring boot test program for different rest frameworks: RestClient, WebClient and OpenFeign: see https://github.com/oliverfuehrer/restdemo

I tried to test CircutBreaker behaviour within feign client controller. I wanted to configure TimeLimiter timeout to something different than default value (1s), but I always get the default. See following configuration:

spring:
  cloud:
    openfeign:
      circuitbreaker:
        enabled: true
        alphanumeric-ids:
          enabled: true
resilience4j:
  circuitbreaker:
    instances:
      RestserverDemoFeignClientgetSampleResponse:
        minimumNumberOfCalls: 5
  timelimiter:
    instances:
      RestserverDemoFeignClientgetSampleResponse:
        timeoutDuration: 20s

The problem could be that within spring-cloud-circuitbreaker-resilience4j-3.1.0-RC1-sources.jar!/org/springframework/cloud/circuitbreaker/resilience4j/Resilience4JCircuitBreakerFactory.java:165 only the defaultConfiguration is used 'this.circuitBreakerRegistry.getConfiguration(id)' but the correct TimeLimiterConfiguration is stored within the entryMap of the used Registry. See attached screenshot from my debug session:

image

oliverfuehrer commented 10 months ago

Seems to work now - sorry ;)