https://github.com/venth/failsafe-rxjava2
RxJava2 (ReactiveX) circuit breaker operator based on FailSafe
https://github.com/venth/failsafe-rxjava2
circuit-breaker java java-8 reactivex rxjava2
Last synced: 3 months ago
JSON representation
RxJava2 (ReactiveX) circuit breaker operator based on FailSafe
- Host: GitHub
- URL: https://github.com/venth/failsafe-rxjava2
- Owner: venth
- License: mit
- Created: 2018-01-01T11:33:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-04T09:50:56.000Z (over 8 years ago)
- Last Synced: 2024-10-31T09:05:11.841Z (over 1 year ago)
- Topics: circuit-breaker, java, java-8, reactivex, rxjava2
- Language: Java
- Size: 80.1 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Circuit Breaker Operator for RxJava2 (ReactiveX)
[](https://travis-ci.org/venth/failsafe-rxjava2)
[]()
Since introduction of [Spring Reactive](https://docs.spring.io/spring/docs/5.0.x/spring-framework-reference/web-reactive.html#spring-webflux)
appeared a need of a circuit breaker that would follow the reactive principles and is very light.
[FailSafe](https://github.com/jhalterman/failsafe) provides very light circuit breaker which works perfectly with
Callable and Runnable and is complicated when comes to an application on an observable sequence.
This project brings new rxjava2 circuit breaker operator based on [FailSafe](https://github.com/jhalterman/failsafe)
which aims to be easy to use.
# Usage
## gradle
```gradle
compile 'com.github.venth.failsafe:rxjava2:x.y.z'
```
## maven
```maven
com.github.venth.failsafe
rxjava2
x.y.z
```
Usage for each of the ReactiveX observables type is pretty similar. The examples presented below
shall explain the usage.
* xxxSequence - a sequence that depends on the operator's type.
* circuitBreaker is configured instance of [FailSafe](https://github.com/jhalterman/failsafe) CircuitBreaker.
## Maybe
```
maybeSequence.lift(CircuitBreakerOperator.of(circuitBreaker))
.subscribe()
```
## Single
```
singleSequence.lift(CircuitBreakerOperator.of(circuitBreaker))
.subscribe()
```
## Observable
```
observableSequence.lift(CircuitBreakerOperator.of(circuitBreaker))
.subscribe()
```
## Flowable
```
flowableSequence.lift(CircuitBreakerOperator.of(circuitBreaker))
.subscribe()
```
## Completable
```
completableSequence.lift(CircuitBreakerOperator.of(circuitBreaker))
.subscribe()
```