Downgrade processing of dubbo service:
The processing method (fault tolerance) when the service is unavailable cannot be processed and returns null
Service downgrade
Write dynamic configuration coverage rules to the registry: (completed by the monitoring center or governance center page)
RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.
class
).getAdaptiveExtension();
Registry registry = registryFactory.getRegistry(URL.valueOf(
"zookeeper://10.20.153.10:2181"
));
registry.register(URL.valueOf(
"override://0.0.0.0/com.foo.BarService?category=configurators&dynamic=false&application=foo&mock=force:return+null"
));
|
in:
mock=force:
return
+
null
|
- Indicates that the consumer's method calls to the service directly return null values, and do not initiate remote calls.
- Shields the impact on callers when unimportant services are unavailable.
Can also be changed to:
mock=fail:
return
+
null
|
- Indicates that the consumer's method call to the service fails, and then returns a null value without throwing an exception.
- Tolerate the impact on callers when uncritical services are unstable.
Labels: