Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

IClientConfig and IClientConfigKey of Ribbon

Shulou Source: shulou.com Published: 2022-06-03 06:38:55 11月23日 Update

Reference address: http://cloud.spring.io/spring-cloud-netflix/single/spring-cloud-netflix.html#spring-cloud-ribbon

IClientConfig

Its main function is to load configuration information, which is used to initialize clients and load balancers. The default implementation is DefaultClientConfigImpl.

Public IClientConfig set (IClientConfigKey key, T value); public T get (IClientConfigKey key, T defaultValue)

DefaultClientConfigImpl

It loads ClientConfig through Archaius. Configuration parameters can be done through the configuration file or system properties. You can also load IClientConfig programmatically.

Configuration parameter format of the configuration file:

... =

ClientName is matching the service name of a service, such as user.

NameSpace is the namespace, and the default is ribbon.

If there is no clientName, it is valid for all client. Such as:

Ribbon.ReadTimeout=1000 default clientConfig, parameters:

Load the corresponding parameter types through CommonClientConfigKey:

CommonClientConfigKey

Its function is to define various parameters and corresponding types. Implementation features: self-contained definition of constant classes.

Tags: Parameters configurations functions can be passed that is files methods types services valid balanced information name address customer client constant format feature space Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Xiaomi NVidia OPPO Reno Apple