sentinel热点流控与持久化

@SentinelResource热点名称随意,这里为abc,监控也监控bac,上面配置的是才懂第一个参数开始,qps>1就熔断
@GetMapping("/testHotKey")
@SentinelResource(value ="abc",blockHandler = "deal_testHotKey")//热键名称唯一
public String testHotKey(@RequestParam(value ="p1",required = false)String p1,
@RequestParam(value ="p2",required = false)String p2){
return "----testHotKey";
}
public String deal_testHotKey(String p1, String p2,BlockException blockException){
return "----deal_testHotKey,o(╥﹏╥)o";
}
依赖
<!-- 后面做持久化用到,如果不持久化也可以不用-->
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-datasource-nacos</artifactId>
</dependency>

[
{
"resource": "/tateLimit/byUrl",
"limitApp": "default",
"grade": 1,
"count": 1,
"strategy": 0,
"controlBehavior": 0,
"clusterMode": false
}
]

本文来自博客园,作者:余生请多指教ANT,转载请注明原文链接:https://www.cnblogs.com/wangbiaohistory/p/16123030.html

浙公网安备 33010602011771号