- 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 MultiMergecollectFailures()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 java.util.concurrent.Flow.Publisher<T>> iterable)<T> Multi<T>streams(java.util.concurrent.Flow.Publisher<T>... publishers)MultiMergewithConcurrency(int concurrency)Indicates that the merge process can consume up toconcurrencystreams concurrently.MultiMergewithRequests(int requests)Indicates that the merge process should consume the different streams using the givenrequest.
-
-
-
Method Detail
-
streams
@SafeVarargs @CheckReturnValue public final <T> Multi<T> streams(java.util.concurrent.Flow.Publisher<T>... publishers)
Creates a newMultimerging the items emitted by the givenmultis/publishers.If you pass no
publishers, the resultingMultiemits the completion event immediately after subscription. If you pass a singlepublisher, the resultingMultiemits the events from thatpublisher. If you pass multiplepublishers, the resultingMultiemits the events from thepublishers, until all thepublisherscompletes. When the lastpublishercompletes, it sends the completion event.If any of the
publisheremits 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 the
publisherdoes not matter and items from several upstreampublisherscan 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
Multimerging the passedpublisher, so emitting the items from thesepublishers.
-
streams
@CheckReturnValue public <T> Multi<T> streams(java.lang.Iterable<? extends java.util.concurrent.Flow.Publisher<T>> iterable)
Creates a newMultimerging the items emitted by the givenpublishers/publishers.If you pass no
publishers, the resultingMultiemits the completion event immediately after subscription. If you pass a singlepublisher, the resultingMultiemits the events from thatpublisher. If you pass multiplepublishers, the resultingMultiemits the events from thepublishers, until all thepublisherscompletes. When the lastpublishercompletes, it sends the completion event.If any of the
publisheremits 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 the
publisherdoes not matter and items from several upstreampublisherscan 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
Multiemitting the items from the given set ofFlow.Publisher
-
collectFailures
@CheckReturnValue 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 aCompositeExceptionif several failures have been received).- Returns:
- a new
MultiMergecollecting failures
-
withRequests
@CheckReturnValue 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
MultiMergeconfigured with the given requests
-
withConcurrency
@CheckReturnValue public MultiMerge withConcurrency(int concurrency)
Indicates that the merge process can consume up toconcurrencystreams concurrently. Items emitted by these streams may be interleaved in the resulting stream.- Parameters:
concurrency- the concurrency- Returns:
- a new
MultiMergeconfigured with the given concurrency
-
-