Hystrix的笔记
来源:互联网 发布:金融管理信息系统软件 编辑:程序博客网 时间:2024/06/05 09:30
github https://github.com/Netflix/Hystrix (基本原理)
https://github.com/Netflix/Hystrix/tree/master/hystrix-contrib/hystrix-javanica (用注解写Htstrix)
spring文档 http://projects.spring.io/spring-cloud/spring-cloud.html#_spring_cloud_netflix
简单的例子 https://eacdy.gitbooks.io/spring-cloud-book/content/2%20Spring%20Cloud/2.4.2%20Hystrix%20Dashboard.html
知乎 https://zhuanlan.zhihu.com/p/26426835
cache 和 config 的写法见 https://github.com/Netflix/Hystrix/tree/master/hystrix-contrib/hystrix-javanica
@CacheRemove(commandKey = "getUserById") @HystrixCommand public void update(@CacheKey("id") User user) { storage.put(user.getId(), user); }
@CacheResult @HystrixCommand public void getUserByProfileName(@CacheKey("profile.email") User user) { storage.getUserByProfileName(user.getProfile().getName()); }添加缓存和删除缓存,id指的是user的id属性,profile.email指的是user的profile属性的email属性
public class UserService { @CacheResult @HystrixCommand public User getUserById(@CacheKey String id) { // GET return storage.get(id); } @CacheRemove(commandKey = "getUserById") @HystrixCommand public void update(@CacheKey("id") User user) { // SET storage.put(user.getId(), user); } }缓存的get和set的用法
通过设置分组HystrixCommandGroupKey 来给所有的command分组,同组的command默认使用相同的线程池
command有四种获取结果的方式,单一的结果execute,异步的结果queue,多个结果toObservable/observe(返回observable发射源)
相应的fallback也可以设置成异步和同步
阅读全文
0 0
- Hystrix的笔记
- Hystrix学习笔记一
- Hystrix个人笔记
- Hystrix使用笔记
- Hystrix系列-4-Hystrix的动态配置
- Hystrix的简单介绍
- hystrix的超时含义
- hystrix 1.5.13 学习笔记
- SpringCloud学习笔记-Hystrix熔断器
- hystrix学习笔记(三):hystrix应用实例
- hystrix学习笔记(四):hystrix应用配置实例
- Hystrix
- Hystrix
- Feign对Hystrix的支持
- Hystrix的使用(一)
- hystrix缓存功能的使用
- 十二、断路器-Hystrix 的认识
- Hystrix监控的配置详解
- 指针数组和数组指针及相关概念
- PMCAFF产品经理第一课 | 杭州站 现场集锦
- tcp/ip协议栈--socket API 之bind()
- 用你的linux pc作为Mac备份的云端时间胶囊
- iOS真机调试与发布操作步骤
- Hystrix的笔记
- 百度推送SDK之开发指南(三)
- git下载代码
- 新路程------gpio按键获取按下抬起信息
- Spring Boot 官方文档学习(一)入门及使用
- 第四周项目三(3)判断链表是否递增
- Git简要教程
- Spring 整合Mongodb
- lhgdialog的传值问题