Zuul Retry in Dalston
I am using Dalston.BUILD-SNAPSHOT version along with 1.5.3.RELEASE Spring Boot Version.
and I have set the following properties:
ribbon:
MaxAutoRetries: 5
MaxAutoRetriesNextServer: 5
OkToRetryOnAllOperations: true
OkToRetryOnAllErrors: true
zuul:
retryable: true
the above properties are not being reflected RequestSpecificRetryHandler, I am not trying to customize Zuul retry logic at least for now ... I only want the retry mechanisim to kick in upon Connect failures ! but while debugging RequestSpecificRetryHandler variables (okToRetryOnAllErrors, okToRetryOnConnectionErrors) are always set to false; the constructor of RibbonLoadBalancingHttpClient is always invoked (return new RequestSpecificRetryHandler(false, false, RetryHandler.DEFAULT, null);
requests instantly fails when services are down and there are no signs of any retry.
alright , so I had to include spring-retry and spring-aop dependencies and then annotate the zuul app with @EnableRetry doing that along with above configurations worked for me , enable debug level on spring retry and u will see those statements:
2017-08-08 12:05:21.740 DEBUG [public-api-gateway,759378a8d6711cfb,ff8ccfcfd2719f6a,false] 22135 --- [io-7683-exec-11] o.s.retry.support.RetryTemplate : Retry: count=0
2017-08-08 12:05:21.741 DEBUG [public-api-gateway,759378a8d6711cfb,ff8ccfcfd2719f6a,false] 22135 --- [io-7683-exec-11] o.s.retry.support.RetryTemplate : Checking for rethrow: count=1
2017-08-08 12:05:21.741 DEBUG [public-api-gateway,759378a8d6711cfb,ff8ccfcfd2719f6a,false] 22135 --- [io-7683-exec-11] o.s.retry.support.RetryTemplate : Checking for rethrow: count=1
The only thing you should need to do is to add spring-retry to the classpath. No need to add spring-aop or add the @enableretry annotation.