vertx-lang-scala-docs_2.12 3.4.1 API < Back
 

# Packages

-  package root
  Definition Classes
    root
-  package io
  Definition Classes
    root
-  package vertx
  Definition Classes
    io
-  package scala
  Definition Classes
    vertx
-  package core
  Definition Classes
    scala
-  package cli
  Definition Classes
    core
-  package datagram
  Definition Classes
    core
-  package dns
  Definition Classes
    core
-  package eventbus
  Definition Classes
    core
-  package file
  Definition Classes
    core
-  package http
  Definition Classes
    core
-  package metrics
  Definition Classes
    core
-  package net
  Definition Classes
    core
-  package parsetools
  Definition Classes
    core
-  package shareddata
  Definition Classes
    core
-  package streams
  Definition Classes
    core
- CompositeFuture
- Context
- DeploymentOptions
- Future
- MultiMap
- TimeoutStream
- Vertx
- VertxOptions
- WorkerExecutor

c

io.vertx.scala.core

# Vertx 

###
Companion object Vertx

#### class Vertx extends Measured

The entry point into the Vert.x Core API.

You use an instance of this class for functionality including:

- Creating TCP clients and servers
- Creating HTTP clients and servers
- Creating DNS clients
- Creating Datagram sockets
- Setting and cancelling periodic and one-shot timers
- Getting a reference to the event bus API
- Getting a reference to the file system API
- Getting a reference to the shared data API
- Deploying and undeploying verticles

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.scala.core.Vertx#vertx, io.vertx.scala.core.Vertx#vertx and io.vertx.scala.core.Vertx#clusteredVertxFuture.

Please see the user manual for more detailed usage information.

Linear Supertypes
Measured, AnyRef, Any
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. Vertx
2. Measured
3. AnyRef
4. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Instance Constructors

1.  new Vertx(_asJava: AnyRef)

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##(): Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
5.  def asJava: AnyRef
   Definition Classes
     Vertx → Measured
6.  def cancelTimer(id: Long): Boolean

   Cancels the timer with the specified `id`.

   Cancels the timer with the specified `id`.

   id

     The id of the timer to cancel

   returns

     true if the timer was successfully cancelled, or false if the timer does not exist.

7.  def clone(): AnyRef
   Attributes
     protected[java.lang]
   Definition Classes
     AnyRef
   Annotations
     @throws( ... )
8.  def close(completionHandler: Handler[AsyncResult[Unit]]): Unit

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

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

   completionHandler

     The handler will be notified when the close is complete.

9.  def close(): Unit

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

   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.

10.  def closeFuture(): scala.concurrent.Future[Unit]

    Like close but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

11.  def createDatagramSocket(): DatagramSocket

    Create a datagram socket using default options

    Create a datagram socket using default options

    returns

      the socket

12.  def createDatagramSocket(options: DatagramSocketOptions): DatagramSocket

    Create a datagram socket using the specified options

    Create a datagram socket using the specified options

    options

      the options to usesee DatagramSocketOptions

    returns

      the socket

13.  def createDnsClient(port: Int, host: String): DnsClient

    Create a DNS client to connect to a DNS server at the specified host and port

    Create a DNS client to connect to a DNS server at the specified host and port

    port

      the port

    host

      the host

    returns

      the DNS client

14.  def createHttpClient(): HttpClient

    Create a HTTP/HTTPS client using default options

    Create a HTTP/HTTPS client using default options

    returns

      the client

15.  def createHttpClient(options: HttpClientOptions): HttpClient

    Create a HTTP/HTTPS client using the specified options

    Create a HTTP/HTTPS client using the specified options

    options

      the options to usesee HttpClientOptions

    returns

      the client

16.  def createHttpServer(): HttpServer

    Create an HTTP/HTTPS server using default options

    Create an HTTP/HTTPS server using default options

    returns

      the server

17.  def createHttpServer(options: HttpServerOptions): HttpServer

    Create an HTTP/HTTPS server using the specified options

    Create an HTTP/HTTPS server using the specified options

    options

      the options to usesee HttpServerOptions

    returns

      the server

18.  def createNetClient(): NetClient

    Create a TCP/SSL client using default options

    Create a TCP/SSL client using default options

    returns

      the client

19.  def createNetClient(options: NetClientOptions): NetClient

    Create a TCP/SSL client using the specified options

    Create a TCP/SSL client using the specified options

    options

      the options to usesee NetClientOptions

    returns

      the client

20.  def createNetServer(): NetServer

    Create a TCP/SSL server using default options

    Create a TCP/SSL server using default options

    returns

      the server

21.  def createNetServer(options: NetServerOptions): NetServer

    Create a TCP/SSL server using the specified options

    Create a TCP/SSL server using the specified options

    options

      the options to usesee NetServerOptions

    returns

      the server

22.  def 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.

    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.scala.core.WorkerExecutor sharing the same name are closed.

    name

      the name of the worker executor

    poolSize

      the size of the pool

    maxExecuteTime

      the value of max worker execute time, in ns

    returns

      the named worker executor

23.  def createSharedWorkerExecutor(name: String, poolSize: Int): WorkerExecutor

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

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

24.  def createSharedWorkerExecutor(name: String): WorkerExecutor

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

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

25.  def deployVerticle(name: String, options: DeploymentOptions, completionHandler: Handler[AsyncResult[String]]): Unit

    Like io.vertx.scala.core.Vertx#deployVerticleFuture but DeploymentOptions are provided to configure the deployment.

    Like io.vertx.scala.core.Vertx#deployVerticleFuture but DeploymentOptions are provided to configure the deployment.

    name

      the name

    options

      the deployment options.see DeploymentOptions

    completionHandler

      a handler which will be notified when the deployment is complete

26.  def deployVerticle(name: String, options: DeploymentOptions): Unit

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

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

    name

      the name

    options

      the deployment options.see DeploymentOptions

27.  def deployVerticle(name: String, completionHandler: Handler[AsyncResult[String]]): Unit

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

    Like io.vertx.scala.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.

    name

      The identifier

    completionHandler

      a handler which will be notified when the deployment is complete

28.  def deployVerticle(name: String): Unit

    Deploy a verticle instance given a name.

    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.

    name

      the name.

29.  def deployVerticleFuture(name: String, options: DeploymentOptions): scala.concurrent.Future[String]

    Like deployVerticle but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

30.  def deployVerticleFuture(name: String): scala.concurrent.Future[String]

    Like deployVerticle but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

31.  def deploymentIDs(): Set[String]

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

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

    returns

      Set of deployment IDs

32.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
33.  def equals(arg0: Any): Boolean
    Definition Classes
      AnyRef → Any
34.  def eventBus(): EventBus

    Get the event bus object.

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

    returns

      the event bus object

35.  def exceptionHandler(handler: Handler[Throwable]): Vertx

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

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

    handler

      the exception handler

    returns

      a reference to this, so the API can be used fluently

36.  def executeBlocking[T](blockingFunction: () ⇒ T, ordered: Boolean = true): scala.concurrent.Future[T]

    Safely execute some blocking code.

    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 returned Future will be completed with the result.

    blockingFunction

      function containing blocking code

    ordered

      if true then if executeBlocking is called several times on the same context, the executions for that context will be executed serially, not in parallel. if false then they will be no ordering guarantees

    returns

      a Future representing the result of the blocking operation

37.  def fileSystem(): FileSystem

    Get the filesystem object.

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

    returns

      the filesystem object

38.  def finalize(): Unit
    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )
39.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
40.  def getOrCreateContext(): Context

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

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

    returns

      The current context (created if didn't exist)

41.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
42.  def isClustered(): Boolean

    Is this Vert.x instance clustered?

    Is this Vert.x instance clustered?

    returns

      true if clustered

43.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
44.  def isMetricsEnabled(): Boolean

    Whether the metrics are enabled for this measured object

    Whether the metrics are enabled for this measured object

    returns

      true if the metrics are enabled

    Definition Classes
      Vertx → Measured
45.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
46.  final def notify(): Unit
    Definition Classes
      AnyRef
47.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
48.  def periodicStream(delay: Long): TimeoutStream

    Returns a periodic timer as a read stream.

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

    delay

      the delay in milliseconds, after which the timer will fire

    returns

      the periodic stream

49.  def runOnContext(action: Handler[Unit]): 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.

    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.

    action

      - a handler representing the action to execute

50.  def 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.

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

    delay

      the delay in milliseconds, after which the timer will fire

    handler

      the handler that will be called with the timer ID when the timer fires

    returns

      the unique ID of the timer

51.  def 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.

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

    delay

      the delay in milliseconds, after which the timer will fire

    handler

      the handler that will be called with the timer ID when the timer fires

    returns

      the unique ID of the timer

52.  def sharedData(): SharedData

    Get the shared data object.

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

    returns

      the shared data object

53.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
54.  def timerStream(delay: Long): TimeoutStream

    Returns a one-shot timer as a read stream.

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

    delay

      the delay in milliseconds, after which the timer will fire

    returns

      the timer stream

55.  def toString(): String
    Definition Classes
      AnyRef → Any
56.  def undeploy(deploymentID: String, completionHandler: Handler[AsyncResult[Unit]]): Unit

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

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

    deploymentID

      the deployment ID

    completionHandler

      a handler which will be notified when the undeployment is complete

57.  def undeploy(deploymentID: String): Unit

    Undeploy a verticle deployment.

    Undeploy a verticle deployment.

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

    deploymentID

      the deployment ID

58.  def undeployFuture(deploymentID: String): scala.concurrent.Future[Unit]

    Like undeploy but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

59.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
60.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
61.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

### Inherited from Measured

### Inherited from AnyRef

### Inherited from Any

### Ungrouped