Package io.smallrye.mutiny.vertx
Class UniHelper
- java.lang.Object
 - 
- io.smallrye.mutiny.vertx.UniHelper
 
 
- 
public class UniHelper extends Object
 
- 
- 
Constructor Summary
Constructors Constructor Description UniHelper() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> io.vertx.core.Future<T>toFuture(io.smallrye.mutiny.Uni<T> single)Adapts anUni<T>to a Vert.xFuture.static <T> io.smallrye.mutiny.subscription.UniSubscriber<T>toSubscriber(io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> handler)Adapts an Vert.xHandler<AsyncResult<T>>to anUniSubscriber.static <T> io.smallrye.mutiny.Uni<T>toUni(io.vertx.core.Future<T> future)static <T> io.smallrye.mutiny.Uni<T>toUni(Consumer<io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>> handler)Returns aUnithat, when subscribed, uses the providedhandlerto adapt a callback-based asynchronous method. 
 - 
 
- 
- 
Field Detail
- 
NOOP
public static Consumer NOOP
 
 - 
 
- 
Method Detail
- 
toUni
public static <T> io.smallrye.mutiny.Uni<T> toUni(Consumer<io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>> handler)
Returns aUnithat, when subscribed, uses the providedhandlerto adapt a callback-based asynchronous method.For example:
{ @code io.vertx.core.Vertx vertx = Vertx.vertx(); UniblockingMethodResult = UniHelper .toMaybe(handler -> vertx. executeBlocking(fut -> fut.complete(invokeBlocking()), handler)); } This is useful when using Mutiny without the Vert.x Mutiny API or your own asynchronous methods.
- Parameters:
 handler- the code executed when the returnedUniis subscribed.- Returns:
 - the uni
 
 
- 
toFuture
public static <T> io.vertx.core.Future<T> toFuture(io.smallrye.mutiny.Uni<T> single)
Adapts anUni<T>to a Vert.xFuture.The single will be immediately subscribed and the returned future will be updated with the result of the single.
- Parameters:
 single- the single to adapt- Returns:
 - the future
 
 
- 
toUni
public static <T> io.smallrye.mutiny.Uni<T> toUni(io.vertx.core.Future<T> future)
 
- 
toSubscriber
public static <T> io.smallrye.mutiny.subscription.UniSubscriber<T> toSubscriber(io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> handler)
Adapts an Vert.xHandler<AsyncResult<T>>to anUniSubscriber.The returned observer can be subscribed to an
Uni.subscribe().- Parameters:
 handler- the handler to adapt- Returns:
 - the observer
 
 
 - 
 
 -