An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# Circuit Breaker Operator for RxJava2 (ReactiveX)
[![Build Status](https://travis-ci.org/venth/failsafe-rxjava2.svg?branch=master)](https://travis-ci.org/venth/failsafe-rxjava2)
[![Maven Central](https://img.shields.io/maven-central/v/com.github.venth.failsafe/rxjava2.svg?style=plastic)]()
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()
```