Class UniCombine


  • public class UniCombine
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      UniZip all()
      Combines a set of unis into a joined item.
      UniAny any()
      Creates a Uni forwarding the first event (item or failure).
      • Methods inherited from class java.lang.Object

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

      • INSTANCE

        public static final UniCombine INSTANCE
    • Method Detail

      • any

        @CheckReturnValue
        public UniAny any()
        Creates a Uni forwarding the first event (item or failure). It behaves like the fastest of these competing unis. If the passed iterable is empty, the resulting Uni gets a null item just after subscription.

        This method subscribes to the set of Uni. When one of the Uni fires an item or a failure a failure, the event is propagated downstream. Also the other subscriptions are cancelled.

        Note that the callback from the subscriber are called on the thread used to fire the event of the selected Uni. Use Uni.emitOn(Executor) to change that thread.

        If the subscription to the returned Uni is cancelled, the subscription to the unis contained in the iterable are also cancelled.

        Returns:
        the object to enlist the candidates
      • all

        @CheckReturnValue
        public UniZip all()
        Combines a set of unis into a joined item. This item can be a Tuple or the item of a combinator function.

        If one of the combine Uni fire a failure, the other unis are cancelled, and the resulting Uni fires the failure. If collectFailures() is called, it waits for the completion of all the unis before propagating the failure event. If more than one Uni failed, a CompositeException is fired, wrapping the different collected failures.

        Depending on the number of participants, the produced Tuple is different from Tuple2 to Tuple5. For more participants, use UniZip.unis(Uni[]) or UniZip.unis(Iterable).

        Returns:
        the object to configure the join