The publish operator

Reactor provides the publish operator to generate a ConnectedFlux. Unlike the replay operator, which buffers events received by the first subscriber, the publish operator gets events from the source stream. The operator keeps track of the demands raised by its subscribers. If any subscriber does not raise a demand, it pauses the event generation until a new demand is raised by all of its subscribers. Consider the following diagram:

Just like the replay operator, the ConnectedFlux generated by the publisher also needs subscriber management. Here, we can configure this by using any of the following three options—connect ...

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.