Skip to content

venth/failsafe-rxjava2

Repository files navigation

Circuit Breaker Operator for RxJava2 (ReactiveX)

Build Status Maven Central Since introduction of Spring Reactive appeared a need of a circuit breaker that would follow the reactive principles and is very light.

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 which aims to be easy to use.

Usage

gradle

compile 'com.github.venth.failsafe:rxjava2:x.y.z'

maven

<dependency>
    <groupId>com.github.venth.failsafe</groupId>
    <artifactId>rxjava2</artifactId>
    <version>x.y.z</version>
</dependency>

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 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()

About

RxJava2 (ReactiveX) circuit breaker operator based on FailSafe

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published