Class MultiConcat


  • public class MultiConcat
    extends java.lang.Object
    Creates new Multi by concatenating several Multi or Publisher. This class allows configuring how the concatenation is executed. Unlike a merge, a concatenation emits the items in order. Streams are read one-by-one and the items are emitted in this order.
    • Constructor Summary

      Constructors 
      Constructor Description
      MultiConcat​(boolean collectFailures)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      MultiConcat collectFailures()
      Indicates that the concatenation 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)
      Creates a new Multi concatenating the items emitted by the given multis / publishers.
      <T> Multi<T> streams​(org.reactivestreams.Publisher<T>... publishers)
      Creates a new Multi concatenating the items emitted by the given multis / publishers.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MultiConcat

        public MultiConcat​(boolean collectFailures)
    • Method Detail

      • streams

        @SafeVarargs
        @CheckReturnValue
        public final <T> Multi<T> streams​(org.reactivestreams.Publisher<T>... publishers)
        Creates a new Multi concatenating the items emitted by the given multis / publishers.

        If you pass no publishers, the resulting Multi emits the completion event immediately after subscription. If you pass a single publisher, the resulting Multi emits the events from that publisher. If you pass multiple publishers, the resulting Multi emits the events from the first publisher. When this one emits the completion event, it drops that event and emits the events from the next publisher and so on until it reaches the last publisher. When the last publisher is consumed, it sends the completion event.

        If any of the publisher emits a failure, the failure is passed downstream and the concatenation stops. This behavior can be changed using collectFailures(). 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 a CompositeException, otherwise it receives the collected failure. IMPORTANT: The order of the publisher matters.

        Type Parameters:
        T - the type of item
        Parameters:
        publishers - the publishers, can be empty, must not contain null
        Returns:
        the new Multi emitting the items from the given set of Multi concatenating the passed publishers.
      • streams

        @CheckReturnValue
        public <T> Multi<T> streams​(java.lang.Iterable<? extends org.reactivestreams.Publisher<T>> iterable)
        Creates a new Multi concatenating the items emitted by the given multis / publishers.

        If you pass no publishers, the resulting Multi emits the completion event immediately after subscription. If you pass a single publisher, the resulting Multi emits the events from that publisher. If you pass multiple publishers, the resulting Multi emits the events from the first publisher. When this one emits the completion event, it drops that event and emits the events from the second publisher and so on until it reaches the last publisher. When the last publisher is consumed, it sends the completion event.

        If any of the publisher emits a failure, the failure is passed downstream and the concatenation stops. This behavior can be changed using collectFailures(). 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 a CompositeException, otherwise it receives the collected failure. IMPORTANT: The order of the publisher matters.

        Type Parameters:
        T - the type of item
        Parameters:
        iterable - the publishers, can be empty, must not contain null, must not be null
        Returns:
        the new Multi emitting the items from the given set of Multi concatenating the passed publishers.
      • collectFailures

        @CheckReturnValue
        public MultiConcat collectFailures()
        Indicates that the concatenation 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 a CompositeException if several failures have been received).
        Returns:
        this MultiConcat configured to collect the failures.