vertx-lang-scala-docs_2.12 3.5.3.CR1 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
     @native() @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(options: DnsClientOptions): DnsClient

    Create a DNS client to connect to a DNS server

    Create a DNS client to connect to a DNS server

    options

      the client optionssee DnsClientOptions

    returns

      the DNS client

14.  def createDnsClient(): DnsClient

    Create a DNS client to connect to the DNS server configured by VertxOptions

    Create a DNS client to connect to the DNS server configured by VertxOptions

    DNS client takes the first configured resolver address provided by ``

    returns

      the DNS client

15.  def 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)

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

    port

      the port

    host

      the host

    returns

      the DNS client

16.  def createHttpClient(): HttpClient

    Create a HTTP/HTTPS client using default options

    Create a HTTP/HTTPS client using default options

    returns

      the client

17.  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

18.  def createHttpServer(): HttpServer

    Create an HTTP/HTTPS server using default options

    Create an HTTP/HTTPS server using default options

    returns

      the server

19.  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

20.  def createNetClient(): NetClient

    Create a TCP/SSL client using default options

    Create a TCP/SSL client using default options

    returns

      the client

21.  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

22.  def createNetServer(): NetServer

    Create a TCP/SSL server using default options

    Create a TCP/SSL server using default options

    returns

      the server

23.  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

24.  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

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

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

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

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

27.  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

28.  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

29.  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

30.  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.

31.  def deployVerticle(verticle: ScalaVerticle, options: DeploymentOptions): Unit

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

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

    verticle

      the verticle instance to deploy

    options

      the deployment options.

32.  def deployVerticle(verticle: ScalaVerticle): Unit

    Deploy a verticle instance that you have created yourself.

    Deploy a verticle instance that you have created yourself.

    Vert.x will assign the verticle a context and start the verticle.

    The actual deploy happens asynchronously and may not complete until after the call has returned.

    verticle

      the verticle instance to deploy.

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

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

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

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

35.  def deployVerticleFuture(verticle: ScalaVerticle, options: DeploymentOptions): scala.concurrent.Future[String]

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

36.  def deployVerticleFuture(verticle: ScalaVerticle): scala.concurrent.Future[String]

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

37.  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

38.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
39.  def equals(arg0: Any): Boolean
    Definition Classes
      AnyRef → Any
40.  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

41.  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

42.  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

43.  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

44.  def finalize(): Unit
    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )
45.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
46.  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)

47.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
48.  def isClustered(): Boolean

    Is this Vert.x instance clustered?

    Is this Vert.x instance clustered?

    returns

      true if clustered

49.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
50.  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
51.  def isNativeTransportEnabled(): Boolean

    returns

      wether the native transport is used

52.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
53.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
54.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
55.  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

56.  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

57.  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

58.  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

59.  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

60.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
61.  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

62.  def toString(): String
    Definition Classes
      AnyRef → Any
63.  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

64.  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

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

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

66.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
67.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
68.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @native() @throws( ... )

### Inherited from Measured

### Inherited from AnyRef

### Inherited from Any

### Ungrouped