java.lang.Object
io.smallrye.mutiny.groups.MultiReplay
Group to configure replaying a
Multi to multiple subscribers.-
Constructor Details
-
MultiReplay
public MultiReplay()
-
-
Method Details
-
upTo
Limit the number of items each new subscriber gets. The default is to replay all events.- Parameters:
numberOfItemsToReplay- a strictly positive number of items to be replayed, whereLong.MAX_VALUEmeans replaying all events- Returns:
- this group
-
ofMulti
Create a replayMulti.Replaying work as follows.
- The provided
upstreamMultiis turned into a hot-stream as it gets requestedLong.MAX_VALUEelements. This happens at the first subscription request. Note thatupstreamwill never be cancelled. - Each new subscriber to this replay
Multiis able to replay items at its own pace (back-pressure is honored). - When the number of items to replay is limited using
upTo(long), then a new subscriber gets to replay starting from the current position in the upstream replay log. When the number of elements to replay is unbounded, then a new subscriber replays from the start. - All current and late subscribers observe terminal completion / error signals.
- Items are pushed synchronously to subscribers when they call
Flow.Subscription.request(long)and there are enough elements to satisfy a part of the demand. Otherwise items are pushed from the upstream to all subscribers with an outstanding demand.
Replaying a large number of elements can be costly, as items have to be kept in-memory. It is NOT recommended using this operator with unbounded streams, especially as they can't be canceled (the subscribers can cancel replays, though). In such cases and especially when you have to keep replay data around for a long time then some eventing middleware might be a better fit.
- The provided
-
ofSeedAndMulti
Create a replayMultiwith some seed elements inserted before the providedMultiitems.The behavior is that of
ofMulti(Multi), except that the items fromseedare prepended to those fromupstreamin the replay log.
-