Skip to content

Commit

Permalink
Document possible alternative to replay ManySink limit(0) (#2787)
Browse files Browse the repository at this point in the history
This commit documents `limit(Duration.ZERO)` as a possible alternative
to `Sinks.many().replay().limit(0)`, which is forbidden.

Fixes #2772.
  • Loading branch information
simonbasle committed Sep 24, 2021
1 parent 793d162 commit a024120
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions reactor-core/src/main/java/reactor/core/publisher/Sinks.java
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,9 @@ public interface MulticastReplaySpec {
* <li>Replaying: up to {@code historySize} elements pushed to this sink are replayed to new subscribers.
* Older elements are discarded.</li>
* </ul>
* <p>
* Note that though historySize of zero is forbidden, the desired equivalent effect can usually be achieved
* with the {@link Duration} based variant: {@link #limit(Duration) limit(Duration.ZERO)}.
*
* @param historySize maximum number of elements able to replayed, strictly positive
*/
Expand Down Expand Up @@ -611,6 +614,9 @@ public interface MulticastReplaySpec {
* Older elements are discarded.</li>
* </ul>
* Note: Age is checked when a signal occurs, not using a background task.
* <p>
* Note that though historySize of zero is forbidden, the desired equivalent effect can usually be achieved
* by setting the {@code maxAge} to {@link Duration#ZERO}.
*
* @param historySize maximum number of elements able to replayed, strictly positive
* @param maxAge maximum retention time for elements to be retained
Expand All @@ -628,6 +634,9 @@ public interface MulticastReplaySpec {
* Older elements are discarded.</li>
* </ul>
* Note: Age is checked when a signal occurs, not using a background task.
* <p>
* Note that though historySize of zero is forbidden, the desired equivalent effect can usually be achieved
* by setting the {@code maxAge} to {@link Duration#ZERO}.
*
* @param historySize maximum number of elements able to replayed, strictly positive
* @param maxAge maximum retention time for elements to be retained
Expand Down

0 comments on commit a024120

Please sign in to comment.