vertx / io.vertx.rxjava.core / RxHelper

RxHelper

open class RxHelper

A set of helpers for RxJava and Vert.x.

Author
Julien Viet

Constructors

<init>

RxHelper()

A set of helpers for RxJava and Vert.x.

Functions

blockingScheduler

open static fun blockingScheduler(vertx: Vertx): Scheduler

Create a scheduler for a Vertx object, actions can be blocking, they are not executed on Vertx event loop.

deployVerticle

open static fun deployVerticle(vertx: Vertx, verticle: Verticle): Observable<String>

Deploy a verticle you have created yourself, using an RxJava vertx instance.

open static fun deployVerticle(vertx: Vertx, verticle: Verticle, options: DeploymentOptions): Observable<String>

Like #deployVerticle(Vertx, Verticle), but io.vertx.core.DeploymentOptions are provided to configure the deployment.

get

open static fun get(client: HttpClient, requestURI: String): Observable<HttpClientResponse>
open static fun get(client: HttpClient, host: String, requestURI: String): Observable<HttpClientResponse>
open static fun get(client: HttpClient, port: Int, host: String, requestURI: String): Observable<HttpClientResponse>open static fun get(client: HttpClient, port: Int, host: String, requestURI: String, headers: MultiMap): Observable<HttpClientResponse>

Returns an Observable<HttpClientResponse> that performs a get request each time it is subscribed. The returned observable can be used to consume the response.

This is different from the HttpClientRequest#toObservable() that should be subscribed before the request is ended and should be consumed immediatly and once.

scheduler

open static fun scheduler(vertx: Vertx): Scheduler

Create a scheduler for a Vertx object, actions are executed on the event loop of the current context.

open static fun scheduler(executor: WorkerExecutor): Scheduler

Create a scheduler for a WorkerExecutor object, actions are executed on the threads of this executor.

open static fun scheduler(context: Context): Scheduler

Create a scheduler for a Context, actions are executed on the event loop of this context.

schedulerHook

open static fun schedulerHook(vertx: Vertx): RxJavaSchedulersHook

Create a scheduler hook for a io.vertx.rxjava.core.Vertx object.

open static fun schedulerHook(context: Context): RxJavaSchedulersHook

Create a scheduler hook for a io.vertx.rxjava.core.Context object.

unmarshaller

open static fun <T : Any> unmarshaller(mappedType: Class<T>): Operator<T, Buffer>

Returns a json unmarshaller for the specified java type as a rx.Observable.Operator instance. The marshaller can be used with the rx.Observable#lift(rx.Observable.Operator) method to transform a Observable<Buffer> into a Observable<T>. The unmarshaller buffers the content until onComplete is called, then unmarshalling happens. Note that the returned observable will emit at most a single object.