What is ReactiveX?

An API for reactive programming

What is reactive programming?

Turning everything into an asynchrnous data stream and programming with asynchronous data streams

Concurrency made easy

Abstract away low-level threading, synchronization, and concurrency issues

Why would you want to use ReactiveX?

Async error handling

  • Client code treats all calls with the API as asynchronous
  • The API implementation can choose to be blocking or non-blocking
  • Allows the API owner to retain control over concurrency behaviour
Java: RxJava
JavaScript: RxJS
C#: Rx.NET
C#(Unity): UniRx
Scala: RxScala
Clojure: RxClojure
C++: RxCpp
Lua: RxLua
Ruby: Rx.rb
Python: RxPY
Go: RxGo
Groovy: RxGroovy
JRuby: RxJRuby
Kotlin: RxKotlin
Swift: RxSwift
PHP: RxPHP
Elixir: reaxive
Dart: RxDart

Lots of languages and lots of people using them

ReactiveX is a combination of the best ideas from
the Observer pattern, the Iterator pattern, and functional programming

public Data getData();
public Data getData();
public void getData(Callback<Data> c);
public Data getData();
public void getData(Callback<Data> c);
public Future<Data> getData();
public Data getData();
public void getData(Callback<Data> c);
public Future<Data> getData();
public Future<List<Future<Data>>> getData();

Really good toolbox of functions to combine, create and filter any of those streams

RxJava in the BI team

Quick look at our code

Issues with this architecture

  • How do we handle backpressure along the stack?
  • How do we guarantee exactly once message delivery?
  • What happens if a component crashes?

Proposed solution

  • Leverage on Kafka and Flink to handle these issues
  • Stream processing framework
  • Distributed, fault tolerant, high availability

Proposed architecture

Questions?

rxJava

By Tom Hanley