Learn from me Spring cloud-client load balancer: Ribbon

Source: Internet
Author: User

The ribbon is a client load balancer that provides good control over the behavior of HTTP and TCP clients. feign already uses the Ribbon, so if you use it @FeignClient , this section also applies.

the central concept in the Ribbon is the concept of a specified client. Each load balancer is part of a combination of combinations that work together to contact a remote server as needed, and the collection has a name that you use as an application developer, such as a @FeignClient comment. Spring Cloud uses RibbonClientConfiguration a new ensemble as needed for each named client to create ApplicationContext . This contains (among other things) ILoadBalancer , RestClient and ServerListFilter .

to include the Ribbon in your project, use org.springframework.cloud the starter for group and artifact IDs spring-cloud-starter-ribbon . for More information about using the current Spring Cloud Publishing list settings to build your system, see The Spring Cloud project page .

Customizing the Ribbon client

You can use <client>.ribbon.* the external properties in to configure some bits of the Ribbon client, which is not the same as using the Netflix API itself, but only with the spring boot configuration file. native options can be CommonClientConfigKey checked as static fields (in the core section of the Ribbon).

Spring Cloud also allows you @RibbonClient to fully control the client by using the claim other configuration (on RibbonClientConfiguration top). Example:

@Configuration@RibbonClient(name = "foo", configuration = FooConfiguration.class)public class TestConfiguration {}

In this case, the client consists of a RibbonClientConfiguration component that already exists in it and FooConfiguration any of the components in it (the latter will usually overwrite the former).

More information and source source

Learn from me Spring cloud-client load balancer: Ribbon

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.