spring-cloud-gateway: Retry do not work in case of circuit breaker fallback

Describe the bug There is a problem in the case of using together Spring Cloud Gateway ‘retry’ and spring-cloud-circuitbreaker-resilience4j ‘fallback’.

If resilience4j fallback is configured, ‘retry’ stops working. Without fallback, retry works well. Simple application:

Sample In the following example, retry(3) does not work.

@SpringBootApplication
@EnableDiscoveryClient
public class DemoApplication {

	public static void main(String[] args) {
		SpringApplication.run(DemoApplication.class, args);
	}
	
	@Bean
	public RouteLocator testRouteLocator(final RouteLocatorBuilder routeLocatorBuilder) {
		return routeLocatorBuilder.routes()
				.route("test Route", p -> p.path("/test-route")
						.filters(f -> f.rewritePath("/test-route", "/v1/test-route")
								.retry(3)
								.circuitBreaker(c -> c.setName("testCircuitBreaker")
										.setFallbackUri("forward:/fallback/test")
								)
						)
						.uri("lb://test-service")).build();
	}
}
// .. endpoint @RequestMapping("/fallback/test")

‘springCloudVersion’, “Hoxton.SR1” ‘org.springframework.cloud:spring-cloud-starter-gateway’ ‘org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j’

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (15 by maintainers)

Most upvoted comments

That’s a different problem that, IIRC, has been addressed already. https://github.com/spring-cloud/spring-cloud-circuitbreaker/pull/56