Reactive Programming

Why Reactive Programming:

Before talking about reactive programming, let’s summarize what we were before 10–15 years ago. In the software world, we were using monolith architecture. Most of the servers run on app servers. We hadn’t figured out the mechanism of the distribution systems.

Expectations from the software

Today we are expecting from the software that it should be scaled up based on the load. So that it can use its resources efficiently. A server should be much much faster.

Limitations of the traditional software design

It limits the concurrent user at a time. It is blocking and synchronizing. Traditional APIs did not support the back pressure.

Better design API

A server can support multiple concurrent users at a time. It shouldn’t be blocking or synchronizing. It should be compatible with back pressure. It should use fewer threads.

Reactive Streams

Dictionary says: A stream is a steady flow of something

  1. Non-blocking backpressure: It is a mechanism where the consumer can request the producer to slow down, whenever the consumer is slow in processing data
Assembly line
  • Subscriber(subscriber)
  • Processor(transformer)
  • Subscription(life cycle)


The reactor provides two main publishers.

  • Mono (single signal)


The subscriber is the other end of the reactive stream which is the receiver of the signals/data. It receives the final output of the reactive stream.


The processor is the main part of the stream. In the processor, we modify data/signals. There are some methods which are used to process the data.

  1. FlatMap
  2. Filter
  3. onErrorMap
  4. onErrorResume


A Subscription represents a one-to-one lifecycle of a Subscriber subscribing to a publisher. In subscription, we can request the publisher to send data or request to stop sending data.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store