java.lang.Object
io.smallrye.mutiny.groups.UniAwaitOptional<T>
- Type Parameters:
T- the type of the item
Likes
UniAwait but wrapping the item event into an Optional. This optional is empty if the
Uni fires null.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSubscribes to theUniand waits (blocking the caller thread) at most the given duration until an item or failure is fired by the upstream uni.Subscribes to theUniand waits (blocking the caller thread) indefinitely until aitemevent is fired or afailureevent is fired by the upstream uni.
-
Constructor Details
-
UniAwaitOptional
-
-
Method Details
-
indefinitely
Subscribes to theUniand waits (blocking the caller thread) indefinitely until aitemevent is fired or afailureevent is fired by the upstream uni.If the
Unifires an item, it returns that item wrapped into anOptional. If the item isnullthe returned optional is empty. If theUnifires a failure, the original exception is thrown (wrapped in aCompletionExceptionit's a checked exception).Note that each call to this method triggers a new subscription.
-
atMost
Subscribes to theUniand waits (blocking the caller thread) at most the given duration until an item or failure is fired by the upstream uni.If the
Unifires an item, it returns that item wrapped into anOptional. If the item isnullthe returned optional is empty. If theUnifires a failure, the original exception is thrown (wrapped in aCompletionExceptionit's a checked exception). If the timeout is reached before completion, aTimeoutExceptionis thrown.Note that each call to this method triggers a new subscription.
- Parameters:
duration- the duration, must not benull, must not be negative or zero.- Returns:
- the item from the
Uni, potentiallynull
-