Backpressure in Akka Streams

published 20.05.2020 02:00

Share

As we can see, this scenario effectively means that the Subscriber will pull the elements from the Publisher, hence this mode of operation is known as pull-based back-pressure.

Here, we communicate with the Publisher by informing them how much of free space the Subscriber has in its buffer to fit incoming data and the Publisher can send as many elements as we have allowed it to send.

In Akka Streams, these concepts are implemented as Source(Publisher), Flow(referred to as Processor in Reactive Streams) and Sink (Subscriber).

One is the source of data, referred to as the Publisher in Reactive streams who will send the data and the other is the one responsible for receiving and buffering, referred to as the Subscriber in Reactive Streams who will receive the data coming from the publisher.

Slow Publisher and Fast Subscriber This scenario is not much of a big problem since you don’t need to slow down the Publisher.