hystrix-javanica微服务弹性框架
javanica 是 Hystrix 开源社区贡献的一个类库。
Java 语言相比其他语言有一些比较 great 的优点,那就是反射(refleaction)和注解(annotation)。在传统的使用 Hystrix 时,你需要编写大量的代码,这显然对开发者并不友好,也会制约 Hystrix 未来的发展。这种模式下,你需要花很长时间编写一些 Hystrix commands。Javanica 项目的想法就是想通过引入 annotation 让你更容易地使用 Hystrix。
使用
要使用 hystrix-javanica,首先要在项目中加入 hystrix-javanica 的依赖。
<dependency> <groupId>com.netflix.hystrix</groupId> <artifactId>hystrix-javanica</artifactId> <version>x.y.z</version> </dependency>
为了实现 AOP 的功能,如果项目中已经使用了 AspectJ,那么还需要在 aop.xml 中添加 hystrix 的切面:
<aspects> ... <aspect name="com.netflix.hystrix.contrib.javanica.aop. aspectj.HystrixCommandAspect"/> ... </aspects>
更多 AspectJ 的配置你可以点击这里。
如果使用 Spring AOP,那么需要通过使用 Spring AOP 的 namespace 来添加指定的配置,这样让 Spring 能够去管理切面,那些你使用 AspectJ 切面,需要像下面这样声明HystrixCommandAspect 作为 Spring 的 bean:
<aop:aspectj-autoproxy/> <bean id="hystrixAspect" class="com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect"></bean>
如果使用Spring的代码配置方式的话,则像下面这样:
@Configuration public class HystrixConfiguration { @Bean public HystrixCommandAspect hystrixAspect() { return new HystrixCommandAspect(); } }
无论使用哪种方式来创建 proxy,javanica 都可以和 JDK 以及 CGLIB proxy 配合得很好。
评论
ezrpc微服务框架
ezrpc是一个微服务框架,用于服务器端的RPC通讯。基于nats和thrift实现,使用代码生成方法,支持Go和C#.服务定义:service Category { list<strin
ezrpc微服务框架
0
gRPC-Nebula微服务框架
东方证券宣布开源其基于gRPC框架开发的微服务框架gRPC-Nebula。据了解,gRPC-Nebula框架具有服务自动注册、服务发现、链路跟踪、服务治理等特性,为证券行业自身所特有的痛点提供了解决方
gRPC-Nebula微服务框架
0
Colossus微服务框架
Colossus是Tumblr出品的一个轻量级的框架用来构建高性能的应用,使用非堵塞网络I/O。Colossus主要侧重于开发低延迟、无状态的微服务,这个服务可以是一个简单的数据库或者缓存的抽象。Co
Colossus微服务框架
0
JWCloud微服务框架
项目介绍JavaWeb_Cloud_Ant是基于SpringCloud+Vue+AntDesign+Shiro+MybatisPlus研发的权限(RBAC)及内容管理系统,致力于做更简洁的后台管理框架
JWCloud微服务框架
0