Skip to end of metadata
Go to start of metadata

Service Degradation

(+) (#)

2.2.0以上版本支持

向注册中心写入动态配置覆盖规则:(通过由监控中心或治理中心的页面完成)

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"));

其中:

mock=force:return+null
  • 表示消费方对该服务的方法调用都直接返回null值,不发起远程调用。
  • 屏蔽不重要服务不可用时对调用方的影响。

还可以改为:

mock=fail:return+null
  • 表示消费方对该服务的方法调用在失败后,再返回null值,不抛异常。
  • 容忍不重要服务不稳定时对调用方的影响。
Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Anonymous replies:

You are not logged in. Any changes you make will be marked as anonymous.
CAPTCHA image