vertx / io.vertx.reactivex.core / Vertx

Vertx

open class Vertx : Measured

The entry point into the Vert.x Core API.

You use an instance of this class for functionality including:

Most functionality in Vert.x core is fairly low level.

To create an instance of this class you can use the static factory methods: io.vertx.reactivex.core.Vertx#vertx, io.vertx.reactivex.core.Vertx#vertx and io.vertx.reactivex.core.Vertx#clusteredVertx.

Please see the user manual for more detailed usage information.

NOTE: This class has been automatically generated from the io.vertx.core.Vertx non RX-ified interface using Vert.x codegen.

Constructors

<init>

Vertx(delegate: Vertx)

Properties

__TYPE_ARG

static val __TYPE_ARG: TypeArg<Vertx>

Functions

cancelTimer

open fun cancelTimer(id: Long): Boolean

Cancels the timer with the specified id.

close

open fun close(): Unit

Stop the the Vertx instance and release any resources held by it.

The instance cannot be used after it has been closed.

The actual close is asynchronous and may not complete until after the call has returned.

open fun close(completionHandler: Handler<AsyncResult<Void>>): Unit

Like io.vertx.reactivex.core.Vertx#close but the completionHandler will be called when the close is complete

clusteredVertx

open static fun clusteredVertx(options: VertxOptions, resultHandler: Handler<AsyncResult<Vertx>>): Unit

Creates a clustered instance using the specified options.

The instance is created asynchronously and the resultHandler is called with the result when it is ready.

createDatagramSocket

open fun createDatagramSocket(options: DatagramSocketOptions): DatagramSocket

Create a datagram socket using the specified options

open fun createDatagramSocket(): DatagramSocket

Create a datagram socket using default options

createDnsClient

open fun createDnsClient(port: Int, host: String): DnsClient

Create a DNS client to connect to a DNS server at the specified host and port, with the default query timeout (5 seconds)

open fun createDnsClient(): DnsClient

Create a DNS client to connect to the DNS server configured by io.vertx.core.VertxOptions

DNS client takes the first configured resolver address provided by }

open fun createDnsClient(options: DnsClientOptions): DnsClient

Create a DNS client to connect to a DNS server

createHttpClient

open fun createHttpClient(options: HttpClientOptions): HttpClient

Create a HTTP/HTTPS client using the specified options

open fun createHttpClient(): HttpClient

Create a HTTP/HTTPS client using default options

createHttpServer

open fun createHttpServer(options: HttpServerOptions): HttpServer

Create an HTTP/HTTPS server using the specified options

open fun createHttpServer(): HttpServer

Create an HTTP/HTTPS server using default options

createNetClient

open fun createNetClient(options: NetClientOptions): NetClient

Create a TCP/SSL client using the specified options

open fun createNetClient(): NetClient

Create a TCP/SSL client using default options

createNetServer

open fun createNetServer(options: NetServerOptions): NetServer

Create a TCP/SSL server using the specified options

open fun createNetServer(): NetServer

Create a TCP/SSL server using default options

createSharedWorkerExecutor

open fun createSharedWorkerExecutor(name: String): WorkerExecutor

Like io.vertx.reactivex.core.Vertx#createSharedWorkerExecutor but with the io.vertx.core.VertxOptions poolSize.

open fun createSharedWorkerExecutor(name: String, poolSize: Int): WorkerExecutor

Like io.vertx.reactivex.core.Vertx#createSharedWorkerExecutor but with the io.vertx.core.VertxOptions maxExecuteTime.

open fun createSharedWorkerExecutor(name: String, poolSize: Int, maxExecuteTime: Long): WorkerExecutor

Create a named worker executor, the executor should be closed when it's not needed anymore to release resources. This method can be called mutiple times with the same name. Executors with the same name will share the same worker pool. The worker pool size and max execute time are set when the worker pool is created and won't change after.

The worker pool is released when all the io.vertx.reactivex.core.WorkerExecutor sharing the same name are closed.

currentContext

open static fun currentContext(): Context

Gets the current context

deployVerticle

open fun deployVerticle(name: String): Unit

Deploy a verticle instance given a name.

Given the name, Vert.x selects a instance to use to instantiate the verticle.

For the rules on how factories are selected please consult the user manual.

open fun deployVerticle(name: String, completionHandler: Handler<AsyncResult<String>>): Unit

Like io.vertx.reactivex.core.Vertx#deployVerticle but the completionHandler will be notified when the deployment is complete.

If the deployment is successful the result will contain a String representing the unique deployment ID of the deployment.

This deployment ID can subsequently be used to undeploy the verticle.

open fun deployVerticle(name: String, options: DeploymentOptions): Unit
open fun deployVerticle(name: String, options: DeploymentOptions, completionHandler: Handler<AsyncResult<String>>): Unit

Like io.vertx.reactivex.core.Vertx#deployVerticle but io.vertx.core.DeploymentOptions are provided to configure the deployment.

deploymentIDs

open fun deploymentIDs(): MutableSet<String>

Return a Set of deployment IDs for the currently deployed deploymentIDs.

equals

open fun equals(other: Any?): Boolean

eventBus

open fun eventBus(): EventBus

Get the event bus object. There is a single instance of EventBus per Vertx instance.

exceptionHandler

open fun exceptionHandler(handler: Handler<Throwable>): Vertx

Set a default exception handler for io.vertx.reactivex.core.Context, set on at creation.

executeBlocking

open fun <T : Any> executeBlocking(blockingCodeHandler: Handler<Future<T>>, ordered: Boolean, resultHandler: Handler<AsyncResult<T>>): Unit

Safely execute some blocking code.

Executes the blocking code in the handler blockingCodeHandler using a thread from the worker pool.

When the code is complete the handler resultHandler will be called with the result on the original context (e.g. on the original event loop of the caller).

A Future instance is passed into blockingCodeHandler. When the blocking code successfully completes, the handler should call the io.vertx.reactivex.core.Future#complete or io.vertx.reactivex.core.Future#complete method, or the io.vertx.reactivex.core.Future#fail method if it failed.

In the blockingCodeHandler the current context remains the original context and therefore any task scheduled in the blockingCodeHandler will be executed on the this context and not on the worker thread.

open fun <T : Any> executeBlocking(blockingCodeHandler: Handler<Future<T>>, resultHandler: Handler<AsyncResult<T>>): Unit

Like io.vertx.reactivex.core.Vertx#executeBlocking called with ordered = true.

fileSystem

open fun fileSystem(): FileSystem

Get the filesystem object. There is a single instance of FileSystem per Vertx instance.

getDelegate

open fun getDelegate(): Vertx

getOrCreateContext

open fun getOrCreateContext(): Context

Gets the current context, or creates one if there isn't one

hashCode

open fun hashCode(): Int

isClustered

open fun isClustered(): Boolean

Is this Vert.x instance clustered?

isMetricsEnabled

open fun isMetricsEnabled(): Boolean

Whether the metrics are enabled for this measured object

isNativeTransportEnabled

open fun isNativeTransportEnabled(): Boolean

newInstance

open static fun newInstance(arg: Vertx): Vertx

periodicStream

open fun periodicStream(delay: Long): TimeoutStream

Returns a periodic timer as a read stream. The timer will be fired every delay milliseconds after the has been called.

runOnContext

open fun runOnContext(action: Handler<Void>): Unit

Puts the handler on the event queue for the current context so it will be run asynchronously ASAP after all preceeding events have been handled.

rxClose

open fun rxClose(): Completable

Like io.vertx.reactivex.core.Vertx#close but the completionHandler will be called when the close is complete

rxClusteredVertx

open static fun rxClusteredVertx(options: VertxOptions): Single<Vertx>

Creates a clustered instance using the specified options.

The instance is created asynchronously and the resultHandler is called with the result when it is ready.

rxDeployVerticle

open fun rxDeployVerticle(name: String): Single<String>

Like io.vertx.reactivex.core.Vertx#deployVerticle but the completionHandler will be notified when the deployment is complete.

If the deployment is successful the result will contain a String representing the unique deployment ID of the deployment.

This deployment ID can subsequently be used to undeploy the verticle.

open fun rxDeployVerticle(name: String, options: DeploymentOptions): Single<String>

Like io.vertx.reactivex.core.Vertx#deployVerticle but io.vertx.core.DeploymentOptions are provided to configure the deployment.

rxExecuteBlocking

open fun <T : Any> rxExecuteBlocking(blockingCodeHandler: Handler<Future<T>>, ordered: Boolean): Single<T>

Safely execute some blocking code.

Executes the blocking code in the handler blockingCodeHandler using a thread from the worker pool.

When the code is complete the handler resultHandler will be called with the result on the original context (e.g. on the original event loop of the caller).

A Future instance is passed into blockingCodeHandler. When the blocking code successfully completes, the handler should call the io.vertx.reactivex.core.Future#complete or io.vertx.reactivex.core.Future#complete method, or the io.vertx.reactivex.core.Future#fail method if it failed.

In the blockingCodeHandler the current context remains the original context and therefore any task scheduled in the blockingCodeHandler will be executed on the this context and not on the worker thread.

open fun <T : Any> rxExecuteBlocking(blockingCodeHandler: Handler<Future<T>>): Single<T>

Like io.vertx.reactivex.core.Vertx#executeBlocking called with ordered = true.

rxUndeploy

open fun rxUndeploy(deploymentID: String): Completable

Like io.vertx.reactivex.core.Vertx but the completionHandler will be notified when the undeployment is complete.

setPeriodic

open fun setPeriodic(delay: Long, handler: Handler<Long>): Long

Set a periodic timer to fire every delay milliseconds, at which point handler will be called with the id of the timer.

setTimer

open fun setTimer(delay: Long, handler: Handler<Long>): Long

Set a one-shot timer to fire after delay milliseconds, at which point handler will be called with the id of the timer.

sharedData

open fun sharedData(): SharedData

Get the shared data object. There is a single instance of SharedData per Vertx instance.

timerStream

open fun timerStream(delay: Long): TimeoutStream

Returns a one-shot timer as a read stream. The timer will be fired after delay milliseconds after the has been called.

toString

open fun toString(): String

undeploy

open fun undeploy(deploymentID: String): Unit

Undeploy a verticle deployment.

The actual undeployment happens asynchronously and may not complete until after the method has returned.

open fun undeploy(deploymentID: String, completionHandler: Handler<AsyncResult<Void>>): Unit

Like io.vertx.reactivex.core.Vertx but the completionHandler will be notified when the undeployment is complete.

vertx

open static fun vertx(): Vertx

Creates a non clustered instance using default options.

open static fun vertx(options: VertxOptions): Vertx

Creates a non clustered instance using the specified options