Class UniOnItemDelay<T>

  • Type Parameters:
    T - the type of item

    public class UniOnItemDelay<T>
    extends java.lang.Object
    Configures the delay applied to the item emission. It allows delaying the item emitted by the previous Uni to its downstream.
    • Constructor Summary

      Constructors 
      Constructor Description
      UniOnItemDelay​(Uni<T> upstream, java.util.concurrent.ScheduledExecutorService executor)
      Creates a new UniOnItemDelay instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Uni<T> by​(java.time.Duration duration)
      Delays the item emission by a specific duration.
      UniOnItemDelay<T> onExecutor​(java.util.concurrent.ScheduledExecutorService executor)
      Configures the executor which is used to wait for the delay duration.
      Uni<T> until​(java.util.function.Function<? super T,​Uni<?>> function)
      Delays the item emission until the Uni produced by the given Function emits an item (potentially null)
      • Methods inherited from class java.lang.Object

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

      • UniOnItemDelay

        public UniOnItemDelay​(Uni<T> upstream,
                              java.util.concurrent.ScheduledExecutorService executor)
        Creates a new UniOnItemDelay instance.
        Parameters:
        upstream - the upstream uni
        executor - the executor, can be null, if null used the default worker executor.
    • Method Detail

      • onExecutor

        @CheckReturnValue
        public UniOnItemDelay<T> onExecutor​(java.util.concurrent.ScheduledExecutorService executor)
        Configures the executor which is used to wait for the delay duration.
        Parameters:
        executor - the executor, must not be null
        Returns:
        this UniOnItemDelay.
      • by

        @CheckReturnValue
        public Uni<T> by​(java.time.Duration duration)
        Delays the item emission by a specific duration.
        Parameters:
        duration - the duration of the delay, must not be null, must be strictly positive.
        Returns:
        the produced Uni
      • until

        @CheckReturnValue
        public Uni<T> until​(java.util.function.Function<? super T,​Uni<?>> function)
        Delays the item emission until the Uni produced by the given Function emits an item (potentially null)

        When the upstream emits its item, the passed function is called. The returned Uni is subscribed using the configured executor. Once this Uni emits its item, the item emitted by upstream is propagated downstream. If the Uni fails, the failure is propagated instead.

        Parameters:
        function - the function, must not be null
        Returns:
        the produced Uni.