NOTES: Spring Cloud feign Ribbon configuration

Source: Internet
Author: User

because Spring Cloud Feign client-side load balancing is through Spring Cloud Ribbon implemented, so we can directly configure the Ribbon client to customize the parameters of each service client invocation.

Global configuration

the method of global configuration is very simple, we can use it directly Ribbon.<key>=<value> to set the ribbon 's default parameters, for example, Modify the default client call timeout example below, using the yml format configuration:

Ribbon

ConnectionTimeout:

ReadTimeout:

Specify the configuration of the service

Most of the cases, Our time-out for service calls may be adjusted based on the characteristics of the actual service, so it is not possible to rely solely on the default configuration, using the spring cloud feign When personalized for each service client and using the spring cloud ribbon < client> for use @feignclient annotated name property or the service name specified by the value attribute, which needs to be case-sensitive, as shown in the following example:

ORG. Lixue. HELLOWORLD:

Ribbon

ConnectionTimeout:

ReadTimeout:

Common Ribbon Configurations

&NBSP;  

TD style= "PADDING-TOP:5PX; padding-left:5px; padding-bottom:5px; padding-right:5px; Border-top:none; Border-left:none; Border-bottom:solid #a3a3a3 1.0pt; Border-right:solid #a3a3a3 1.0pt ">

configuration name

connectiontimeout

&NBSP;  

connection time-out

readtimeout

read timeout

oktoretryonalloperatotions

&NBSP;  

retry all operation requests

maxautoretriesnextserver

&NBSP;  

switch server instance retry attempts,

maxautoretries

&NBSP;  

retry attempts on the current instance

Serverlistrefreshinterval

 

Time interval for refreshing service list sources

NOTES: Spring Cloud feign Ribbon configuration

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.