The control centre of the Vert.x Core API.

You should normally only use a single instance of this class throughout your application. If you are running in the Vert.x container an instance will be provided to you.

This class acts as a factory for TCP/SSL and HTTP/HTTPS servers and clients, SockJS servers, and provides an instance of the event bus, file system and shared data classes, as well as methods for setting and cancelling timers.

Create a new Vertx instance. Instances of this class are thread-safe.

By: Julien Viet
  • Vertx
    • Basic
      • Identifiable
      • Object
        • Anything

no subtypes hierarchy

Initializer
Vertx(Vertx delegate = ...)
Parameters:
  • delegate = VertxProvider.create()
Attributes
currentContextshared Context? currentContext

The current context

delegateshared Vertx delegate
eventBusshared EventBus eventBus

The event bus

eventLoopshared Boolean eventLoop

Is the current thread an event loop thread?

fileSystemshared FileSystem fileSystem

The File system object

sharedDatashared SharedData sharedData

The shared data object

workershared Boolean worker

Is the current thread an worker thread?

Inherited Attributes
Attributes inherited from: Object
hash, string
Methods
cancelTimershared Boolean cancelTimer(Integer id)

Cancel the timer with the specified id. Returns true true if the timer was successfully cancelled, or false if the timer does not exist.

createHttpClientshared HttpClient createHttpClient(Integer? port = null, String? host = null)

Create a new http client and return it

Parameters:
  • port = null

    the client port

  • host = null

    the client host

createHttpServershared HttpServer createHttpServer()

Create a new http server and returns it

createNetClientshared NetClient createNetClient()

Create a new net client and return it

createNetServershared NetServer createNetServer()

Create a new net server and returns it

createSockJSServershared SockJSServer createSockJSServer(HttpServer server)

Create a SockJS server that wraps an HTTP server

runOnContextshared void runOnContext(void task())

Put the handler on the event queue for the current loop (or worker context) so it will be run asynchronously ASAP after this event has been processed

setPeriodicshared Integer setPeriodic(Integer delay, void handle(Integer timerId))

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

setTimershared Integer setTimer(Integer delay, void handle(Integer timerId))

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

stopshared void stop()

Stop the eventbus and any resource managed by the eventbus.

Inherited Methods
Methods inherited from: Object
equals