Sync docs from master to gh-pages
This commit is contained in:
@@ -834,8 +834,7 @@ Individual applications must create it.
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>The URI needs to use a virtual host name (that is, a service name, not a host name).
|
||||
The Ribbon client is used to create a full physical address.
|
||||
See {githubroot}/spring-cloud-netflix/blob/master/spring-cloud-netflix-ribbon/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonAutoConfiguration.java[<code>RibbonAutoConfiguration</code>] for the details of how the <code>RestTemplate</code> is set up.</p>
|
||||
The BlockingLoadBalancerClient is used to create a full physical address.</p>
|
||||
</div>
|
||||
<div class="admonitionblock important">
|
||||
<table>
|
||||
@@ -845,24 +844,7 @@ See {githubroot}/spring-cloud-netflix/blob/master/spring-cloud-netflix-ribbon/sr
|
||||
</td>
|
||||
<td class="content">
|
||||
To use a load-balanced <code>RestTemplate</code>, you need to have a load-balancer implementation in your classpath.
|
||||
The recommended implementation is <code>BlockingLoadBalancerClient</code>.
|
||||
Add <a href="#spring-cloud-loadbalancer-starter">Spring Cloud LoadBalancer starter</a> to your project in order to use it.
|
||||
The
|
||||
<code>RibbonLoadBalancerClient</code> also can be used, but it’s now under maintenance and we do not recommend adding it to new projects.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="admonitionblock warning">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="icon">
|
||||
<i class="fa icon-warning" title="Warning"></i>
|
||||
</td>
|
||||
<td class="content">
|
||||
By default, if you have both <code>RibbonLoadBalancerClient</code> and <code>BlockingLoadBalancerClient</code>, to
|
||||
preserve backward compatibility, <code>RibbonLoadBalancerClient</code> is used.
|
||||
To override it, you can set the <code>spring.cloud.loadbalancer.ribbon.enabled</code> property to <code>false</code>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -903,7 +885,7 @@ public class MyClass {
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>The URI needs to use a virtual host name (that is, a service name, not a host name).
|
||||
The Ribbon client or Spring Cloud LoadBalancer is used to create a full physical address.</p>
|
||||
The Spring Cloud LoadBalancer is used to create a full physical address.</p>
|
||||
</div>
|
||||
<div class="admonitionblock important">
|
||||
<table>
|
||||
@@ -916,13 +898,6 @@ If you want to use a <code>@LoadBalanced WebClient.Builder</code>, you need to h
|
||||
implementation in the classpath. We recommend that you add the
|
||||
<a href="#spring-cloud-loadbalancer-starter">Spring Cloud LoadBalancer starter</a> to your project.
|
||||
Then, <code>ReactiveLoadBalancer</code> is used underneath.
|
||||
Alternatively, this functionality also works with <code>spring-cloud-starter-netflix-ribbon</code>, but the request
|
||||
is handled by a non-reactive <code>LoadBalancerClient</code> under the hood. Additionally,
|
||||
<code>spring-cloud-starter-netflix-ribbon</code> is already in maintenance mode, so we do not recommend
|
||||
adding it to new projects.
|
||||
If you have both <code>spring-cloud-starter-loadbalancer</code> and <code>spring-cloud-starter-netflix-ribbon</code>
|
||||
in your classpath, Ribbon is used by default. To switch to Spring Cloud LoadBalancer,
|
||||
set the <code>spring.cloud.loadbalancer.ribbon.enabled</code> property to <code>false</code>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -933,10 +908,7 @@ set the <code>spring.cloud.loadbalancer.ribbon.enabled</code> property to <code>
|
||||
<p>A load-balanced <code>RestTemplate</code> can be configured to retry failed requests.
|
||||
By default, this logic is disabled.
|
||||
You can enable it by adding <a href="https://github.com/spring-projects/spring-retry">Spring Retry</a> to your application’s classpath.
|
||||
The load-balanced <code>RestTemplate</code> honors some of the Ribbon configuration values related to retrying failed requests.
|
||||
You can use <code>client.ribbon.MaxAutoRetries</code>, <code>client.ribbon.MaxAutoRetriesNextServer</code>, and <code>client.ribbon.OkToRetryOnAllOperations</code> properties.
|
||||
If you would like to disable the retry logic with Spring Retry on the classpath, you can set <code>spring.cloud.loadbalancer.retry.enabled=false</code>.
|
||||
See the <a href="https://github.com/Netflix/ribbon/wiki/Getting-Started#the-properties-file-sample-clientproperties">Ribbon documentation</a> for a description of what these properties do.</p>
|
||||
If you would like to disable the retry logic with Spring Retry on the classpath, you can set <code>spring.cloud.loadbalancer.retry.enabled=false</code>.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>If you would like to implement a <code>BackOffPolicy</code> in your retries, you need to create a bean of type <code>LoadBalancedRetryFactory</code> and override the <code>createBackOffPolicy</code> method:</p>
|
||||
@@ -961,18 +933,6 @@ public class MyConfiguration {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="admonitionblock note">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="icon">
|
||||
<i class="fa icon-note" title="Note"></i>
|
||||
</td>
|
||||
<td class="content">
|
||||
<code>client</code> in the preceding examples should be replaced with your Ribbon client’s name.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>If you want to add one or more <code>RetryListener</code> implementations to your retry functionality, you need to
|
||||
create a bean of type <code>LoadBalancedRetryListenerFactory</code> and return the <code>RetryListener</code> array
|
||||
@@ -1185,28 +1145,11 @@ The following example shows how to configure a <code>WebClient</code> to use rea
|
||||
<p>The URI needs to use a virtual host name (that is, a service name, not a host name).
|
||||
The <code>ReactorLoadBalancer</code> is used to create a full physical address.</p>
|
||||
</div>
|
||||
<div class="admonitionblock note">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="icon">
|
||||
<i class="fa icon-note" title="Note"></i>
|
||||
</td>
|
||||
<td class="content">
|
||||
By default, if you have <code>spring-cloud-netflix-ribbon</code> in your classpath, <a href="#load-balancer-exchange-filter-function"><code>LoadBalancerExchangeFilterFunction</code></a>
|
||||
is used to maintain backward compatibility. To use
|
||||
<code>ReactorLoadBalancerExchangeFilterFunction</code>, set the <code>spring.cloud.loadbalancer.ribbon.enabled</code> property
|
||||
to <code>false</code>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="load-balancer-exchange-filter-function"><a class="anchor" href="#load-balancer-exchange-filter-function"></a><a class="link" href="#load-balancer-exchange-filter-function">2.7.2. Spring WebFlux <code>WebClient</code> with a Non-reactive Load Balancer Client</a></h4>
|
||||
<div class="paragraph">
|
||||
<p>If you you do not have <a href="#spring-cloud-loadbalancer-starter">Spring Cloud LoadBalancer starter</a> in your project
|
||||
but you do have spring-cloud-starter-netflix-ribbon, you can still use <code>WebClient</code> with <code>LoadBalancerClient</code>.
|
||||
If <code>spring-webflux</code> is on the classpath, <code>LoadBalancerExchangeFilterFunction</code>
|
||||
<p>If <code>spring-webflux</code> is on the classpath, <code>LoadBalancerExchangeFilterFunction</code>
|
||||
is auto-configured. Note, however, that this
|
||||
uses a non-reactive client under the hood.
|
||||
The following example shows how to configure a <code>WebClient</code> to use load-balancer:</p>
|
||||
@@ -1695,19 +1638,6 @@ and <a href="https://github.com/stoyanr">Evictor</a>.
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="admonitionblock warning">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="icon">
|
||||
<i class="fa icon-warning" title="Warning"></i>
|
||||
</td>
|
||||
<td class="content">
|
||||
If you have both Ribbon and Spring Cloud LoadBalancer int the classpath, in order to maintain backward compatibility, Ribbon-based implementations will be used by default.
|
||||
In order to switch to using Spring Cloud LoadBalancer under the hood, make sure you set the property <code>spring.cloud.loadbalancer.ribbon.enabled</code> to <code>false</code>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="custom-loadbalancer-configuration"><a class="anchor" href="#custom-loadbalancer-configuration"></a><a class="link" href="#custom-loadbalancer-configuration">3.6. Passing Your Own Spring Cloud LoadBalancer Configuration</a></h3>
|
||||
|
||||
Reference in New Issue
Block a user