public class CompletableHelper extends Object
Constructor and Description |
---|
CompletableHelper() |
Modifier and Type | Method and Description |
---|---|
static io.reactivex.Completable |
toCompletable(Consumer<io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>>> handler)
Returns a
Completable that, when subscribed, uses the provided handler to adapt a callback-based asynchronous method. |
static <T> io.reactivex.CompletableObserver |
toObserver(io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> handler)
Adapts an Vert.x
Handler<AsyncResult<T>> to an RxJava2 SingleObserver . |
public static io.reactivex.Completable toCompletable(Consumer<io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>>> handler)
Completable
that, when subscribed, uses the provided handler
to adapt a callback-based asynchronous method.
For example:
io.vertx.core.Vertx vertx = Vertx.vertx();
// ... later
Completable undeploy = CompletableHelper.toCompletable(handler -> vertx.undeploy(deploymentId, handler));
This is useful when using RxJava without the Vert.x Rxified API or your own asynchronous methods.
handler
- the code executed when the returned Completable
is subscribedpublic static <T> io.reactivex.CompletableObserver toObserver(io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> handler)
Handler<AsyncResult<T>>
to an RxJava2 SingleObserver
.
The returned observer can be subscribed to an Single.subscribe(SingleObserver)
.
handler
- the handler to adaptCopyright © 2019 Eclipse. All rights reserved.