framework中的sentinel
引入切面:

切面+sentinel-web-servlet
private void initDataSource() {
String zkUrl = zaSentinelConfig.getDatacource().getAddress();
String appName = environment.getProperty("spring.application.name");
LOGGER.info("=================={} SentinelDataSource init, zookeeper info:{}===========", appName, zkUrl);
// flow
ReadableDataSource<String, List<FlowRule>> flowRuleDataSource = new ZookeeperDataSource<>(zkUrl,
ZookeeperConfigUtil.getPath(appName, RuleTypeEnum.FLOW), source -> JSON.parseObject(source, new TypeReference<List<FlowRule>>() {}));
FlowRuleManager.register2Property(flowRuleDataSource.getProperty());
// degrade
ReadableDataSource<String, List<DegradeRule>> degradeRuleDataSource = new ZookeeperDataSource<>(zkUrl,
ZookeeperConfigUtil.getPath(appName, RuleTypeEnum.DEGRADE), source -> JSON.parseObject(source, new TypeReference<List<DegradeRule>>() {}));
DegradeRuleManager.register2Property(degradeRuleDataSource.getProperty());
// system
ReadableDataSource<String, List<SystemRule>> systemRuleDataSource = new ZookeeperDataSource<>(zkUrl,
ZookeeperConfigUtil.getPath(appName, RuleTypeEnum.SYSTEM), source -> JSON.parseObject(source, new TypeReference<List<SystemRule>>() {}));
SystemRuleManager.register2Property(systemRuleDataSource.getProperty());
// authority
ReadableDataSource<String, List<AuthorityRule>> authorityRuleDataSource = new ZookeeperDataSource<>(zkUrl,
ZookeeperConfigUtil.getPath(appName, RuleTypeEnum.AUTHORITY), source -> JSON.parseObject(source, new TypeReference<List<AuthorityRule>>() {}));
AuthorityRuleManager.register2Property(authorityRuleDataSource.getProperty());
// loadbalance
ReadableDataSource<String, List<LoadBalanceRule>> loadBalanceRuleDataSource =
new ZookeeperDataSource<>(zkUrl, ZookeeperConfigUtil.getPath(appName, RuleTypeEnum.LOAD_BALANCE),
source -> JSON.parseObject(source, new TypeReference<List<LoadBalanceRule>>() {}));
LoadBalanceRuleManager.register2Property(loadBalanceRuleDataSource.getProperty());
}
没啥东西
framework中的sentinel的更多相关文章
- Entity Framework 教程——Entity Framework中的实体类型
Entity Framework中的实体类型 : 在之前的章节中我们介绍过从已有的数据库中创建EDM,它包含数据库中每个表所对应的实体.在EF 5.0/6.0中,存在POCO 实体和动态代理实体两种. ...
- 减小ipa体积之删除frameWork中无用mach-O文件
最近项目末期, 我们团队为了ipa的大小使用不少的体积减小的方法, 除了一些常规的方法之外, 我分享一下自己研究出来的新思路. 首先我们来简单的介绍一下mach-O. 什么是mach-O? Mach- ...
- 转-Spring Framework中的AOP之around通知
Spring Framework中的AOP之around通知 http://blog.csdn.net/xiaoliang_xie/article/details/7049183 标签: spring ...
- Spring Framework------>version4.3.5.RELAESE----->Reference Documentation学习心得----->Spring Framework中的spring web MVC模块
spring framework中的spring web MVC模块 1.概述 spring web mvc是spring框架中的一个模块 spring web mvc实现了web的MVC架构模式,可 ...
- Spring Framework------>version4.3.5.RELAESE----->Reference Documentation学习心得----->Spring Framework中web相关的知识(概述)
Spring Framework中web相关的知识 1.概述: 参考资料:官网documentation中第22小节内容 关于spring web mvc: spring framework中拥有自 ...
- Spring Framework------>version4.3.5.RELAESE----->Reference Documentation学习心得----->关于spring framework中的beans
Spring framework中的beans 1.概述 bean其实就是各个类实例化后的对象,即objects spring framework的IOC容器所管理的基本单元就是bean spring ...
- 关于Entity Framework中的Attached报错相关解决方案的总结
关于Entity Framework中的Attached报错的问题,我这里分为以下几种类型,每种类型我都给出相应的解决方案,希望能给大家带来一些的帮助,当然作为读者的您如果觉得有不同的意见或更好的方法 ...
- 关于Entity Framework中的Attached报错的完美解决方案终极版
之前发表过一篇文章题为<关于Entity Framework中的Attached报错的完美解决方案>,那篇文章确实能解决单个实体在进行更新.删除时Attached的报错,注意我这里说的单个 ...
- .NET Framework 中的所有类型
.NET Framework 中的所有类型不是值类型就是引用类型. 值类型是使用对象实际值来表示对象的数据类型. 如果向一个变量分配值类型的实例,则该变量将被赋以该值的全新副本. 引用类型是使用对对象 ...
随机推荐
- BIO编程
在实际的工作开发中,传统的模型有client/service模型.client端和service端要进行通信的话,有一种套接字的方式.传统的socket编程,包含一个socket服务端和一到多个soc ...
- SpringMVC中ModelAndView的两个jar包引起的思考servlet和portlet
在使用ModelAndView时,需要去导包,但是有两个包. 检查前台form表单提交的也正确,后台这也没有问题. 后来发现竟然时导包导错误了. 到此,如果是因为到错包问题,应该就解决了. 但是,深入 ...
- 【转】Getting an Image on the Screen
FROM:http://lazyfoo.net/tutorials/SDL/02_getting_an_image_on_the_screen/index.php Getting an Image o ...
- Day13 CSS样式
1. css 选择器 1.1 css三种引入方法 <!DOCTYPE HTML> <html> <head> <meta charset="utf- ...
- [Luogu P2278] [HNOI2003]操作系统
题面 传送门:https://www.luogu.org/problemnew/show/P2278 Solutiton 挺简单的一道模拟题,拿堆模拟一下题目意思就好 堆中有两个关键字,分别是优先级和 ...
- UML类图关系表示
UML 之 C++类图关系全面剖析 分类: 软件设计与架构2008-10-16 08:52 5165人阅读 评论(3) 收藏 举报 umlc++borderclasscblog UML的类图关系分为: ...
- P3065 [USACO12DEC]First! G
题意描述 [USACO12DEC]First! G 不错的一道题. 给你 \(N\) 个字符串,要求你求出可能的字典序最小的字符串. 对于 可能的最小的字符串,你可以任意排列 \(26\) 个字母,使 ...
- 毕业一年后接私活赚了10w,还拿了几家大厂offer!
原本计划这周接着写一篇技术文章的,但是没想到忙到天天凌晨回家,几乎没有为下一篇文章做准备的时间(通常写一篇文章需要至少 30 个小时,需要搭进日常下班及周末的休息时间).这周如果写的话精力和时间都达不 ...
- vuex和axios的基本操作
1.在src目录下创建一个api 是用于集中处理axios的相关配置 index.js就是处理axios的文件 具体如何使用axios 还请百度axios 2.URLs.js是存放需要请求的地址的 3 ...
- WSL2:我在原生的Win10玩转Linux系统
原文地址:梁桂钊的博客 博客地址:http://blog.720ui.com 欢迎关注公众号:「服务端思维」.一群同频者,一起成长,一起精进,打破认知的局限性. WSL2:我在原生的Win10玩转Li ...