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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.