feat(openFeign): SentinelResource注解使用
This commit is contained in:
parent
79dc92805a
commit
2dfe3cbac2
|
@ -28,13 +28,20 @@ public class PropertiesController {
|
|||
@SentinelResource(value = "getConfig", fallback = "getConfigFallBack")
|
||||
@Operation(summary = "获取云端配置属性", description = "获取云端配置属性")
|
||||
public String getConfig() {
|
||||
// 也可以使用try进行捕获和处理
|
||||
// try {
|
||||
// SphU.entry("zzz");
|
||||
// } catch (BlockException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
return "timeout:" + orderProperties.getTimeout() + ";autoConfirm:" + orderProperties.getConfirm() + ";dbUrl:" + orderProperties.getDbUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* 当获取速度过快时会走这个
|
||||
* Throwable 好处还可以处理业务错误也可以走这个
|
||||
*/
|
||||
public String getConfigFallBack() {
|
||||
public String getConfigFallBack(Throwable throwable) {
|
||||
return "获取云端配置属性,操作过快。。。";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue