The ReplayProcessor type

ReplayProcessor is a special-purpose processor, capable of caching and replaying events to its subscribers. The processor also has the capability of publishing events from an external publisher. It consumes an event from the injected publisher and synchronously passes it to the subscribers.

ReplayProcessor can cache events for the following scenarios:

  • All events
  • A limited count of events
  • Events bounded by a specified time period
  • Events bounded by a count and a specified time period
  • The last event only

 Once cached, all events are replayed when a subscriber is added:

 

Let's look at the following code:

ReplayProcessor ...

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.