Class UniOnItemDelay<T>

java.lang.Object
io.smallrye.mutiny.groups.UniOnItemDelay<T>
Type Parameters:
T - the type of item

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

    • UniOnItemDelay

      public UniOnItemDelay(Uni<T> upstream, 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 Details

    • onExecutor

      @CheckReturnValue public UniOnItemDelay<T> onExecutor(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(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(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.