Adds backoff policies when retrying requests (#2436)

* Adds backoff policies when retrying requests.  Fixes #2195

* fixing final variable
This commit is contained in:
Ryan Baxter
2017-11-16 20:11:55 -05:00
committed by GitHub
parent 62a8f72b98
commit 6e3b4fdd7b
11 changed files with 212 additions and 22 deletions

View File

@@ -2735,6 +2735,27 @@ https://github.com/spring-projects/spring-retry[Spring Retry] on your applicatio
When Spring Retry is present load balanced `RestTemplates`, Feign, and Zuul will automatically
retry any failed requests (assuming you configuration allows it to).
==== BackOff Policies
By default no backoff policy is used when retrying requests. If you would like to configure
a backoff policy you will need to create a bean of type `LoadBalancedBackOffPolicyFactory`
which will be used to create a `BackOffPolicy` for a given service.
[source,java,indent=0]
----
@Configuration
public class MyConfiguration {
@Bean
LoadBalancedBackOffPolicyFactory backOffPolciyFactory() {
return new LoadBalancedBackOffPolicyFactory() {
@Override
public BackOffPolicy createBackOffPolicy(String service) {
return new ExponentialBackOffPolicy();
}
};
}
}
----
==== Configuration
Anytime Ribbon is used with Spring Retry you can control the retry functionality by configuring