Package io.smallrye.mutiny.groups
Class UniOnItemDelay<T>
- java.lang.Object
-
- io.smallrye.mutiny.groups.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 previousUni
to its downstream.
-
-
Constructor Summary
Constructors Constructor Description UniOnItemDelay(Uni<T> upstream, java.util.concurrent.ScheduledExecutorService executor)
Creates a newUniOnItemDelay
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 theUni
produced by the givenFunction
emits an item (potentiallynull
)
-
-
-
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 benull
- 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 benull
, 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 theUni
produced by the givenFunction
emits an item (potentiallynull
)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 benull
- Returns:
- the produced
Uni
.
-
-