The replay operator

Reactor provides the replay operator to convert a Flux to a ConnectableFlux. The resulting ConnectableFlux keeps buffering events published to the first subscriber. The buffer can be configured to keep the last n entries, or it can be configured to be based on the time duration. Only the buffered events are replayed back to the subscribers.

Refer to the following diagram:

A ConnectableFlux must be subscribed by n subscribers before it starts to publish events. ConnectableFlux provides the following operators to manage subscribers:

  • Connect: The connect operator must be invoked after enough subscriptions have been made. ...

Get Hands-On Reactive Programming with Reactor now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.