Class: Context

vertx-js/context~ Context

new Context()

Source:

Methods

config() → {Object}

If the context is associated with a Verticle deployment, this returns the configuration that was specified when the verticle was deployed.
Source:
Returns:
the configuration of the deployment or null if not a Verticle deployment
Type
Object

deploymentID() → {string}

If the context is associated with a Verticle deployment, this returns the deployment ID of that deployment.
Source:
Returns:
the deployment ID of the deployment or null if not a Verticle deployment
Type
string

get(key) → {Object}

Get some data from the context.
Parameters:
Name Type Description
key string the key of the data
Source:
Returns:
the data
Type
Object

isEventLoopContext() → {boolean}

Is the current context an event loop context?

NOTE! when running blocking code using Vertx#executeBlocking from a standard (not worker) verticle, the context will still an event loop context and this will return true.

Source:
Returns:
true if false otherwise
Type
boolean

isMultiThreadedWorkerContext() → {boolean}

Is the current context a multi-threaded worker context?
Source:
Returns:
true if the current context is a multi-threaded worker context, false otherwise
Type
boolean

isWorkerContext() → {boolean}

Is the current context a worker context?

NOTE! when running blocking code using Vertx#executeBlocking from a standard (not worker) verticle, the context will still an event loop context and this will return false.

Source:
Returns:
true if the current context is a worker context, false otherwise
Type
boolean

owner() → {Vertx}

Source:
Returns:
  • The Vertx instance that created the context
  • Type
    Vertx

processArgs() → {Array.<string>}

The process args
Source:
Returns:
Type
Array.<string>

put(key, value)

Put some data in the context.

This can be used to share data between different handlers that share a context

Parameters:
Name Type Description
key string the key of the data
value Object the data
Source:

remove(key) → {boolean}

Remove some data from the context.
Parameters:
Name Type Description
key string the key to remove
Source:
Returns:
true if removed successfully, false otherwise
Type
boolean

runOnContext(action)

Run the specified action asynchronously on the same context, some time after the current execution has completed.
Parameters:
Name Type Description
action function the action to run
Source: