面向 Java 8 和函数式编程的容错库 Resilience4j | 软件推介

#扫描二维码报名源创会#

授权协议:Apache

开发语言:Java

操作系统:跨平台

Resilience4j 是一个轻量级的容错组件,其灵感来自于 Hystrix,但主要为 Java 8 和函数式编程所设计。轻量级体现在其只用 Vavr 库(前身是 Javaslang),没有任何外部依赖。而 Hystrix 依赖了 Archaius ,Archaius 本身又依赖很多第三方包,例如 Guava、Apache Commons Configuration 等。

限速组件架构:

面向 Java 8 和函数式编程的容错库 Resilience4j | 软件推介

Resilience4j 提供了如下几款核心组件


resilience4j-circuitbreaker: Circuit breaking


resilience4j-ratelimiter: Rate limiting


resilience4j-bulkhead: Bulkheading


resilience4j-retry: Automatic retrying (sync and async)


resilience4j-cache: Response caching

附件组件包括:


resilience4j-reactor: Spring Reactor adapter


resilience4j-rxjava2: RxJava2 adapter


resilience4j-micrometer: Micrometer Metrics exporter


resilience4j-metrics: Dropwizard Metrics exporter


resilience4j-prometheus: Prometheus Metrics exporter


resilience4j-spring-boot: Spring Boot Starter


resilience4j-ratpack: Ratpack Starter


resilience4j-retrofit: Retrofit Call Adapter Factories


resilience4j-vertx: Vertx Future decorator


resilience4j-consumer: Circular Buffer Event consumer

使用示例:


CircuitBreaker, Retry and Fallback


RateLimiter


Bulkhead


Cache


Metrics


Consume emitted events

使用 Resilience4j 实现请求调用频率限制的示例代码:

面向 Java 8 和函数式编程的容错库 Resilience4j | 软件推介

项目详情及源码地址获取:
面向 Java 8 和函数式编程的容错库 Resilience4j | 软件推介