- java.lang.Object
-
- io.smallrye.mutiny.groups.MultiGroupIntoLists<T>
-
public class MultiGroupIntoLists<T> extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description MultiGroupIntoLists(Multi<T> upstream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Multi<java.util.List<T>>every(java.time.Duration duration)Multi<java.util.List<T>>every(java.time.Duration duration, boolean emitEmptyListIfNoItems)Multi<java.util.List<T>>of(int size)Multi<java.util.List<T>>of(int size, int skip)Multi<java.util.List<T>>of(int size, java.time.Duration maximumDelay)
-
-
-
Method Detail
-
every
@CheckReturnValue public Multi<java.util.List<T>> every(java.time.Duration duration)
Creates aMultithat emits lists of items collected from the observedMulti.The resulting
Multiemits connected, non-overlapping lists, each of a fixed duration specified by thedurationparameter. If, during the configured time window, no items are emitted by the upstreamMulti, nothing is emitted downstream.When the upstream
Multisends the completion event, the resultingMultiemits the current list and propagates the completion event.If the upstream
Multisends a failure, the failure is propagated immediately.- Parameters:
duration- the period of time each list collects items before it is emitted and replaced with a new list. Must be nonnulland positive.- Returns:
- a Multi that emits every
durationwith the items emitted by the upstream multi during the time window.
-
every
@CheckReturnValue public Multi<java.util.List<T>> every(java.time.Duration duration, boolean emitEmptyListIfNoItems)
Creates aMultithat emits lists of items collected from the observedMulti.The resulting
Multiemits connected, non-overlapping lists, each of a fixed duration specified by thedurationparameter. If, during the configured time window, no items are emitted by the upstreamMulti, an empty list is emitted by the returnedMultiifemitEmptyListIfNoItemsis set totrue.When the upstream
Multisends the completion event, the resultingMultiemits the current list and propagates the completion event.If the upstream
Multisends a failure, the failure is propagated immediately.- Parameters:
duration- the period of time each list collects items before it is emitted and replaced with a new list. Must be nonnulland positive.emitEmptyListIfNoItems- emits an empty list if no items from the upstream have been received during the time window- Returns:
- a Multi that emits every
durationwith the items emitted by the upstream multi during the time window.
-
of
@CheckReturnValue public Multi<java.util.List<T>> of(int size)
Creates aMultithat emits lists of items collected from the observedMulti.The resulting
Multiemits lists everysizeitems.When the upstream
Multisends the completion event, the producedMultiemits the current list, and sends the completion event. This last list may not containsizeitems. If the upstreamMultisends the completion event before having emitted any event, the completion event is propagated immediately.If the upstream
Multisends a failure, the failure is propagated immediately.- Parameters:
size- the size of each collected list, must be positive- Returns:
- a Multi emitting lists of at most
sizeitems from the upstream Multi.
-
of
@CheckReturnValue public Multi<java.util.List<T>> of(int size, int skip)
Creates aMultithat emits lists of items collected from the observedMulti.The resulting
Multiemits lists everyskipitems, each containingsizeitems.When the upstream
Multisends the completion event, the producedMultiemits the current list, and sends the completion event. This last list may not containsizeitems. If the upstreamMulti* sends the completion event before having emitted any event, the completion event is propagated immediately.If the upstream
Multisends a failure, the failure is propagated immediately.- Parameters:
size- the size of each collected list, must be positive and non-0skip- the number of items skipped before starting a new list. Ifskipandsizeare equal, this operation is similar toof(int). Must be positive and non-0- Returns:
- a Multi emitting lists for every
skipitems from the upstream Multi. Each list contains at mostsizeitems
-
of
@CheckReturnValue public Multi<java.util.List<T>> of(int size, java.time.Duration maximumDelay)
Creates aMultithat emits lists of items collected from the observedMulti.The resulting
Multiemits lists everymaximumDelayduration and splits them into lists ofsizeitems. Therefore, the list may not always containsizeitems but it is guaranteed to emit a list everymaximumDelayduration, if at least one element was emitted by the upstream.When the upstream
Multisends the completion event, the producedMultiemits the current list, and sends the completion event. This last list may also not containsizeitems. If the upstreamMultisends the completion event before having emitted any event, the completion event is propagated immediately.If the upstream
Multisends a failure, the failure is propagated immediately.- Parameters:
size- the maximum size of each collected list, must be positivemaximumDelay- the maximum delay between the upstream emitting an item and a list being emitted by the returnedMulti.- Returns:
- a Multi emitting lists of at most
sizeitems from the upstream Multi.
-
-