Class VerticleBase
- All Implemented Interfaces:
Deployable
In the simplest case, just override the start() method. If you have verticle clean-up to do you can
optionally override the stop() method too.
This class also maintains references to the Vertx and Context
instances of the verticle for easy access.
It also provides methods for getting the verticle configuration and deployment ID.
- Author:
- Tim Fox, Julien Viet
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconfig()Get the configuration of the verticle.final Future<?> Start the deployable.Get the deployment ID of the verticle deploymentvoidInitialise the verticle.Future<?> start()Start the verticle.Future<?> stop()Stop the verticle.final Future<?> Stop the deployable.
-
Field Details
-
vertx
Reference to the Vert.x instance that deployed this verticle -
context
Reference to the context of the verticle
-
-
Constructor Details
-
VerticleBase
public VerticleBase()
-
-
Method Details
-
init
-
deploymentID
Get the deployment ID of the verticle deployment- Returns:
- the deployment ID
-
config
Get the configuration of the verticle.This can be specified when the verticle is deployed.
- Returns:
- the configuration
-
deploy
Description copied from interface:DeployableStart the deployable.Vert.x calls this method when deploying this deployable. You do not call it yourself.
- Specified by:
deployin interfaceDeployable- Parameters:
context- the Vert.x context assigned to this deployable- Returns:
- a future signalling the start-up completion
- Throws:
Exception
-
undeploy
Description copied from interface:DeployableStop the deployable.Vert.x calls this method when undeploying this deployable. You do not call it yourself.
- Specified by:
undeployin interfaceDeployable- Parameters:
context- the Vert.x context assigned to this deployable- Returns:
- a future signalling the clean-up completion
- Throws:
Exception
-
start
Start the verticle.This is called by Vert.x when the verticle instance is deployed. Don't call it yourself.
If your verticle does things in its startup which take some time then you can override this method and call the startFuture some time later when start up is complete.
- Returns:
- a future signalling the start-up completion
- Throws:
Exception
-
stop
-