vertx-lang-scala-docs_2.12 3.8.0 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 json
  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
- Promise
- 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#clusteredVertx.

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`. * @param 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 * @param 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 * @return the socket

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

    Create a datagram socket using the specified options * @param options the options to use see DatagramSocketOptions

    Create a datagram socket using the specified options * @param options the options to use see DatagramSocketOptions

    returns

      the socket

13.  def createDnsClient(options: DnsClientOptions): DnsClient

    Create a DNS client to connect to a DNS server * @param options the client options see DnsClientOptions

    Create a DNS client to connect to a DNS server * @param options the client options see 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 `* @return 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 * @return the client

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

    Create a HTTP/HTTPS client using the specified options * @param options the options to use see HttpClientOptions

    Create a HTTP/HTTPS client using the specified options * @param options the options to use see HttpClientOptions

    returns

      the client

18.  def createHttpServer(): HttpServer

    Create an HTTP/HTTPS server using default options * @return the server

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

    Create an HTTP/HTTPS server using the specified options * @param options the options to use see HttpServerOptions

    Create an HTTP/HTTPS server using the specified options * @param options the options to use see HttpServerOptions

    returns

      the server

20.  def createNetClient(): NetClient

    Create a TCP/SSL client using default options * @return the client

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

    Create a TCP/SSL client using the specified options * @param options the options to use see NetClientOptions

    Create a TCP/SSL client using the specified options * @param options the options to use see NetClientOptions

    returns

      the client

22.  def createNetServer(): NetServer

    Create a TCP/SSL server using default options * @return the server

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

    Create a TCP/SSL server using the specified options * @param options the options to use see NetServerOptions

    Create a TCP/SSL server using the specified options * @param options the options to use see NetServerOptions

    returns

      the server

24.  def createSharedWorkerExecutor(name: String, poolSize: Int, maxExecuteTime: Long, maxExecuteTimeUnit: TimeUnit): 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 , max execute time and unit of 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. * @param name the name of the worker executor

    poolSize

      the size of the pool

    maxExecuteTime

      the value of max worker execute time

    maxExecuteTimeUnit

      the value of unit of max worker execute time

    returns

      the named worker executor

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

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

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

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

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

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

28.  def deployVerticle(name: String, options: DeploymentOptions, completionHandler: Handler[AsyncResult[String]]): 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. * @param name the name

    options

      the deployment options. see DeploymentOptions

    completionHandler

      a handler which will be notified when the deployment is complete

29.  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. * @param name the name

    options

      the deployment options. see DeploymentOptions

30.  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. * @param name The identifier

    completionHandler

      a handler which will be notified when the deployment is complete

31.  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. * @param name the name.

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

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

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

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

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

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

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

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

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

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

38.  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. * @return Set of deployment IDs

39.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
40.  def equals(arg0: Any): Boolean
    Definition Classes
      AnyRef → Any
41.  def eventBus(): EventBus

    Get the event bus object.

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

42.  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. * @param handler the exception handler

    returns

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

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

44.  def fileSystem(): FileSystem

    Get the filesystem object.

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

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

    Gets the current context, or creates one if there isn't one * @return The current context (created if didn't exist)

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

    Is this Vert.x instance clustered? * @return true if clustered

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

    Whether the metrics are enabled for this measured object * @return `true` if metrics are enabled

    Whether the metrics are enabled for this measured object * @return `true` if metrics are enabled

    Definition Classes
      Vertx → Measured
52.  def isNativeTransportEnabled(): Boolean

    returns

      whether the native transport is used

53.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
54.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
55.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
56.  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. * @param delay the delay in milliseconds, after which the timer will fire

    returns

      the periodic stream

57.  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. * @param action - a handler representing the action to execute

58.  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. * @param 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 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. * @param 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

60.  def sharedData(): SharedData

    Get the shared data object.

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

61.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
62.  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. * @param delay the delay in milliseconds, after which the timer will fire

    returns

      the timer stream

63.  def toString(): String
    Definition Classes
      AnyRef → Any
64.  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. * @param deploymentID the deployment ID

    completionHandler

      a handler which will be notified when the undeployment is complete

65.  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. * @param deploymentID the deployment ID

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

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

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

### Inherited from Measured

### Inherited from AnyRef

### Inherited from Any

### Ungrouped