Add spring-cloud-starter-loadbalancer.

This commit is contained in:
Olga Maciaszek-Sharma
2019-09-06 18:43:34 +02:00
parent 64f5a56cc0
commit 2f233f384a
4 changed files with 14 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ See the https://consul.io/intro/index.html[intro] for more information.
* Spring Cloud `DiscoveryClient` implementation
** supports Ribbon and Zuul
** supports Spring Cloud LoadBalancer
* Consul based `PropertySource` loaded during the 'bootstrap' phase.
* Spring Cloud Bus implementation based on Consul https://www.consul.io/docs/agent/http/event.html[events]

View File

@@ -6,6 +6,7 @@ Spring Cloud Consul features:
* Service Discovery: instances can be registered with the Consul agent and clients can discover the instances using Spring-managed beans
* Supports Ribbon, the client side load-balancer via Spring Cloud Netflix
* Supports Spring Cloud LoadBalancer - a client side load-balancer provided by the Spring Cloud project
* Supports Zuul, a dynamic router and filter via Spring Cloud Netflix
* Distributed Configuration: using the Consul Key/Value store
* Control Bus: Distributed control events using Consul Events

View File

@@ -229,7 +229,7 @@ spring:
=== Looking up services
==== Using Ribbon
==== Using Load-balancer
Spring Cloud has support for https://github.com/spring-cloud/spring-cloud-netflix/blob/master/docs/src/main/asciidoc/spring-cloud-netflix.adoc#spring-cloud-feign[Feign] (a REST client builder) and also https://github.com/spring-cloud/spring-cloud-netflix/blob/master/docs/src/main/asciidoc/spring-cloud-netflix.adoc#spring-cloud-ribbon[Spring `RestTemplate`]
for looking up services using the logical service names/ids instead of physical URLs. Both Feign and the discovery-aware RestTemplate utilize https://cloud.spring.io/spring-cloud-netflix/single/spring-cloud-netflix.html#spring-cloud-ribbon[Ribbon] for client-side load balancing.
@@ -259,6 +259,13 @@ If you have Consul clusters in multiple datacenters and you want to access a ser
you use property `spring.cloud.consul.discovery.datacenters.STORES=dc-west` where `STORES` is the service name/id and `dc-west` is the datacenter
where the STORES service lives.
TIP: Spring Cloud now also offers support for
https://cloud.spring.io/spring-cloud-commons/reference/html/#_spring_resttemplate_as_a_load_balancer_client[Spring Cloud LoadBalancer].
As Spring Cloud Ribbon is now under maintenance, we suggest you set `spring.cloud.loadbalancer.default`
to `true`, so that `BlockingLoadBalancerClient` is used instead of `RibbonLoadBalancerClient`.
==== Using the DiscoveryClient
You can also use the `org.springframework.cloud.client.discovery.DiscoveryClient` which provides a simple API for discovery clients that is not specific to Netflix, e.g.

View File

@@ -37,6 +37,10 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>