Class MultiGroupIntoLists<T>
- 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>>
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 aMulti
that emits lists of items collected from the observedMulti
.The resulting
Multi
emits connected, non-overlapping lists, each of a fixed duration specified by theduration
parameter. If, during the configured time window, no items are emitted by the upstreamMulti
, an empty list is emitted by the returnedMulti
.When the upstream
Multi
sends the completion event, the resultingMulti
emits the current list and propagates the completion event.If the upstream
Multi
sends 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 nonnull
and positive.- Returns:
- a Multi that emits every
duration
with the items emitted by the upstream multi during the time window.
-
of
@CheckReturnValue public Multi<java.util.List<T>> of(int size)
Creates aMulti
that emits lists of items collected from the observedMulti
.The resulting
Multi
emits lists everysize
items.When the upstream
Multi
sends the completion event, the producedMulti
emits the current list, and sends the completion event. This last list may not containsize
items. If the upstreamMulti
sends the completion event before having emitted any event, the completion event is propagated immediately.If the upstream
Multi
sends 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
size
items from the upstream Multi.
-
of
@CheckReturnValue public Multi<java.util.List<T>> of(int size, int skip)
Creates aMulti
that emits lists of items collected from the observedMulti
.The resulting
Multi
emits lists everyskip
items, each containingsize
items.When the upstream
Multi
sends the completion event, the producedMulti
emits the current list, and sends the completion event. This last list may not containsize
items. If the upstreamMulti
* sends the completion event before having emitted any event, the completion event is propagated immediately.If the upstream
Multi
sends 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. Ifskip
andsize
are equal, this operation is similar toof(int)
. Must be positive and non-0- Returns:
- a Multi emitting lists for every
skip
items from the upstream Multi. Each list contains at mostsize
items
-
of
@CheckReturnValue public Multi<java.util.List<T>> of(int size, java.time.Duration maximumDelay)
Creates aMulti
that emits lists of items collected from the observedMulti
.The resulting
Multi
emits lists everymaximumDelay
duration and splits them into lists ofsize
items. Therefore, the list may not always containsize
items but it is guaranteed to emit a list everymaximumDelay
duration, if at least one element was emitted by the upstream.When the upstream
Multi
sends the completion event, the producedMulti
emits the current list, and sends the completion event. This last list may also not containsize
items. If the upstreamMulti
sends the completion event before having emitted any event, the completion event is propagated immediately.If the upstream
Multi
sends 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
size
items from the upstream Multi.
-
-