Class UniOnTimeout<T>

java.lang.Object
io.smallrye.mutiny.groups.UniOnTimeout<T>

public class UniOnTimeout<T> extends Object
  • Constructor Details

  • Method Details

    • after

      @CheckReturnValue public UniOnTimeout<T> after(Duration timeout)
      Configures the timeout duration.
      Parameters:
      timeout - the timeout, must not be null, must be strictly positive.
      Returns:
      a new UniOnTimeout
    • on

      @CheckReturnValue public UniOnTimeout<T> on(ScheduledExecutorService executor)
      Configures on which executor the timeout is measured. Note that this executor is also going to be used to fire the Timeout failure event.
      Parameters:
      executor - the executor to use, must not be null
      Returns:
      a new UniOnTimeout
    • fail

      @CheckReturnValue public Uni<T> fail()
    • failWith

      @CheckReturnValue public Uni<T> failWith(Throwable failure)
    • failWith

      @CheckReturnValue public Uni<T> failWith(Supplier<? extends Throwable> supplier)
    • recoverWithItem

      @CheckReturnValue public Uni<T> recoverWithItem(T fallback)
      Produces a new Uni firing a fallback item when the current Uni the upstream Uni do not emit an item before the timeout.

      The fallback item (potentially null) is used as item by the produced Uni.

      Parameters:
      fallback - the fallback value, may be null
      Returns:
      the new Uni
    • recoverWithItem

      @CheckReturnValue public Uni<T> recoverWithItem(Supplier<T> supplier)
      Produces a new Uni firing a fallback item supplied by the given supplier when the current Uni times out. The produced item (potentially null) is fired as item by the produced Uni. Note that if the supplier throws an exception, the produced Uni emits a failure.
      Parameters:
      supplier - the fallback supplier, may be null
      Returns:
      the new Uni
    • recoverWithUni

      @CheckReturnValue public Uni<T> recoverWithUni(Supplier<Uni<? extends T>> supplier)
      Produces a new Uni providing a fallback Uni when the current Uni times out. The fallback is produced using the given supplier, and it called when the failure is caught. The produced Uni is used instead of the current Uni.
      Parameters:
      supplier - the fallback supplier, must not be null, must not produce null
      Returns:
      the new Uni
    • recoverWithUni

      @CheckReturnValue public Uni<T> recoverWithUni(Uni<? extends T> fallback)
      Produces a new Uni providing a fallback Uni when the current Uni times out. The fallback Uni is used instead of the current Uni.
      Parameters:
      fallback - the fallback Uni, must not be null
      Returns:
      the new Uni