dubbo - check at startup

When dubbo wakes up, it will check whether the dependent services are available at startup. If it is not available, it will throw an exception to prevent Spring initialization from completing, so that problems can be found early when going online. The default check=true

The check can be turned off by check=false. For example, when testing, some services do not care, or there is a circular dependency, and one party must start it first.

In addition, if your Spring container is lazy loaded, or the service is delayed through API programming, please turn off check, otherwise, when the service is temporarily unavailable, an exception will be thrown and a null reference will be obtained. If check=false, a reference will always be returned. , when the service is restored, it can be automatically connected.

Example 

via spring configuration file

When the startup check of a service is turned off, there is no provider and an error is reported:

<dubbo:reference interface="com.foo.BarService" check="false"/>

 

Turn off the startup check for all services and report an error when there is no provider:

<dubbo:consumer check="false"/>

Turn off the check at startup of the registry (an error occurs when the registration and subscription fails)

<dubbo:registry check="false"/>

via dubbo.properties

 dubbo.reference.com.foo.BarService.check=false

dubbo.reference.check=false

dubbo.consumer.check=false

dubbo.registry.check=false

Via the -D parameter

java -Ddubbo.reference.com.foo.BarService.check=false

java -Ddubbo.reference.check=false

java -Ddubbo.consumer.check=false

java -Ddubbo.registry.check=false

Meaning of configuration

dubbo.reference.check=false, forcibly change the check value of all reference, even if there is a declaration in the configuration, it will be overwritten.

dubbo.consumer.check=false, is the default value for setting check, if there is an explicit statement in the configuration, such as: <dubbo:reference check="true"/>, it will not be affected

dubbo.registry.check=false, the first two all refer to the success of the subscription, but whether the provider list is empty or not, whether to report an error, if the registration and subscription fails, it is also allowed to start, you need to use this option, it will be retried regularly in the background

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324888422&siteId=291194637