Class MultiMerge
- java.lang.Object
-
- io.smallrye.mutiny.groups.MultiMerge
-
public class MultiMerge extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultiMerge
collectFailures()
Indicates that the merge process should not propagate the first received failure, but collect them until all the items from all (non-failing) participants have been emitted.<T> Multi<T>
streams(java.lang.Iterable<? extends org.reactivestreams.Publisher<T>> iterable)
<T> Multi<T>
streams(org.reactivestreams.Publisher<T>... publishers)
MultiMerge
withConcurrency(int concurrency)
Indicates that the merge process can consume up toconcurrency
streams concurrently.MultiMerge
withRequests(int requests)
Indicates that the merge process should consume the different streams using the givenrequest
.
-
-
-
Method Detail
-
streams
@SafeVarargs public final <T> Multi<T> streams(org.reactivestreams.Publisher<T>... publishers)
Creates a newMulti
merging the items emitted by the givenmultis
/publishers
.If you pass no
publishers
, the resultingMulti
emits the completion event immediately after subscription. If you pass a singlepublisher
, the resultingMulti
emits the events from thatpublisher
. If you pass multiplepublishers
, the resultingMulti
emits the events from thepublishers
, until all thepublishers
completes. When the lastpublisher
completes, it sends the completion event.If any of the
publisher
emits a failure, the failure is passed downstream and the merge stops. This behavior can be changed usingcollectFailures()
. In this case, the failures are accumulated and would be propagated instead of the final completion event. If multiple failures have been collected, the downstream receives aCompositeException
, otherwise it receives the collected failure. IMPORTANT: Unlike concatenation, the order of thepublisher
does not matter and items from several upstreampublishers
can be interleaved in the resultingMulti
.- Type Parameters:
T
- the type of item- Parameters:
publishers
- the publishers, can be empty, must not containnull
- Returns:
- the new
Multi
merging the passedpublisher
, so emitting the items from thesepublishers
.
-
streams
public <T> Multi<T> streams(java.lang.Iterable<? extends org.reactivestreams.Publisher<T>> iterable)
Creates a newMulti
merging the items emitted by the givenpublishers
/publishers
.If you pass no
publishers
, the resultingMulti
emits the completion event immediately after subscription. If you pass a singlepublisher
, the resultingMulti
emits the events from thatpublisher
. If you pass multiplepublishers
, the resultingMulti
emits the events from thepublishers
, until all thepublishers
completes. When the lastpublisher
completes, it sends the completion event.If any of the
publisher
emits a failure, the failure is passed downstream and the merge stops. This behavior can be changed usingcollectFailures()
. In this case, the failures are accumulated and would be propagated instead of the final completion event. If multiple failures have been collected, the downstream receives aCompositeException
, otherwise it receives the collected failure. IMPORTANT: Unlike concatenation, the order of thepublisher
does not matter and items from several upstreampublishers
can be interleaved in the resultingMulti
.- Type Parameters:
T
- the type of item- Parameters:
iterable
- the published, must not be empty, must not containnull
, must not benull
- Returns:
- the new
Multi
emitting the items from the given set ofPublisher
-
collectFailures
public MultiMerge collectFailures()
Indicates that the merge process should not propagate the first received failure, but collect them until all the items from all (non-failing) participants have been emitted. Then, the failures are propagated downstream (as aCompositeException
if several failures have been received).- Returns:
- a new
MultiMerge
collecting failures
-
withRequests
public MultiMerge withRequests(int requests)
Indicates that the merge process should consume the different streams using the givenrequest
.- Parameters:
requests
- the request- Returns:
- a new
MultiMerge
configured with the given requests
-
withConcurrency
public MultiMerge withConcurrency(int concurrency)
Indicates that the merge process can consume up toconcurrency
streams concurrently. Items emitted by these streams may be interleaved in the resulting stream.- Parameters:
concurrency
- the concurrency- Returns:
- a new
MultiMerge
configured with the given concurrency
-
-