Java Spring WebFlux vs RxJava

Both Spring WebFlux (project-reactor) and RxJava2+ are implementation of reactive-streams.

Spring is using project-reactor, therefore it is more supported, advertised and has bigger community, so I would go with that.


Reactive programming is a programming paradigm, but I wouldn’t call it new. It’s actually been around for a while. Just like object-oriented programming, functional programming, or procedural programming, reactive programming is just another programming paradigm.

Paradigm is defined by Reactive Manifesto

Reactive Streams, on the other hand, is a specification.

For Java programmers, Reactive Streams is an API. It is the product of a collaboration between engineers from Kaazing, Netflix, Pivotal, Red Hat, Twitter, Typesafe, and many others. Reactive Streams is much like JPA or JDBC. Both are API specifications.

The Reactive Streams API consists of just 4 high interfaces.

  1. Publisher : A publisher is a provider of a potentially unbounded number of sequenced elements, publishing them according to the demand received from its Subscribers.
  2. Subscriber : Will receive call to Subscriber.onSubscribe(Subscription) once after passing an instance of Subscriber to Publisher.subscribe(Subscriber).
  3. Subscription : A Subscription represents a one-to-one lifecycle of a Subscriber subscribing to a Publisher.
  4. Processor A Processor represents a processing stage—which is both a Subscriber and a Publisher and obeys the contracts of both.

These concepts take different manifestations at different levels and areas. For eg. A java dev could think about how to program his at the application level, a database engineer could think how a database could react to reactive API calls (For example, Mongo DB has implemented a Reactive Streams driver), a network programmer could think how reactive calls could be made effective at network level.

Some of the JVM based frameworks that follows the reactive streams spec are

  • Akka Streams framework
  • Ratpack
  • Vert.x
  • ReactiveX (RxJava 2.x and Reactor)
  • Java 1.9 Flow classes (You’ll notice that the Reactive Streams interfaces move under the Flow class in Java 9)

ReactiveX is a combination of the best ideas from the Observer pattern, the Iterator pattern, and functional programming. It extends the observer pattern to support sequences of data and/or events and adds operators that allow you to compose sequences together declaratively while abstracting away concerns about things like low-level threading, synchronization, thread-safety, concurrent data structures, and non-blocking I/O.

RxJava 2.0 and Reactor are based on ReactiveX project. And Spring WebFlux uses Reactor internally.


In general, RxJava support project which based on JDK8- and Project Reactor supports JDK 8+. But for a beginner, you can learn RxJava at first. Since Project Reactor you can consider it fix the drawbacks in RxJava and more suitable for Backend development. RxJava has too many problems which can cause Out of Memory if you can't use it well. But in final, if you want to use Spring 5.2+ very well, you need to learn from RxJava->Reactor->NIO->Netty->Reactor netty.