Instead of implementing io. directly, it is often simpler to just extend this class.
In the simplest case, just override the start(Promise) method. If you have verticle clean-up to do you can
optionally override the stop(Promise) method too.
If your verticle does extra start-up or clean-up that takes some time (e.g. it deploys other verticles) then
you should override the asynchronous start and stop methods.
This class also maintains references to the io. and io.
instances of the verticle for easy access.
It also provides methods for getting the verticle configuration, process arguments,
and deployment ID.
| Modifier and Type | Field and Description |
|---|---|
| protected Context | context
Reference to the context of the verticle |
| protected Vertx | vertx
Reference to the Vert.x instance that deployed this verticle |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public JsonObject | Returns: the configuration
References Deprecated
JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.
Get the configuration of the verticle. |
| public String | |
| public Vertx | Returns: the Vert.x instanceImplements io. Get the Vert.x instance |
| public void | init(Vertx
the deploying Vert.x instance vertx, Context the context of the verticle context)Implements io. Initialise the verticle. |
| public List | Returns: the list of argumentsGet the arguments used when deploying the Vert.x process. |
| public void | start(Promise<Void>
a promise which should be called when verticle start-up is complete. startPromise)Implements io. Start the verticle. |
| public void | start()
If your verticle does a simple, synchronous start-up then override this method and put your start-up code in here. |
| public void | stop(Promise<Void>
a promise which should be called when verticle clean-up is complete. stopPromise)Implements io. Stop the verticle. |
| public void | stop()
If your verticle has simple synchronous clean-up tasks to complete then override this method and put your clean-up code in here. |
| context | back to summary |
|---|---|
| protected Context context Reference to the context of the verticle | |
| vertx | back to summary |
|---|---|
| protected Vertx vertx Reference to the Vert.x instance that deployed this verticle | |
| AbstractVerticle | back to summary |
|---|---|
| public AbstractVerticle() | |
| config | back to summary |
|---|---|
| public JsonObject config()
References Deprecated
See corresponding docs for further information. Get the configuration of the verticle. This can be specified when the verticle is deployed.
| |
| deploymentID | back to summary |
|---|---|
| public String deploymentID() Get the deployment ID of the verticle deployment
| |
| getVertx | back to summary |
|---|---|
| public Vertx getVertx() Implements io. Get the Vert.x instance | |
| init | back to summary |
|---|---|
| public void init(Vertx vertx, Context context) Implements io. Initialise the verticle. This is called by Vert.x when the verticle instance is deployed. Don't call it yourself. | |
| processArgs | back to summary |
|---|---|
| public List Get the arguments used when deploying the Vert.x process. | |
| start | back to summary |
|---|---|
| public void start(Promise<Void> startPromise) throws Exception Implements io. 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. | |
| start | back to summary |
|---|---|
| public void start() throws Exception If your verticle does a simple, synchronous start-up then override this method and put your start-up code in here. | |
| stop | back to summary |
|---|---|
| public void stop(Promise<Void> stopPromise) throws Exception Implements io. Stop the verticle. This is called by Vert.x when the verticle instance is un-deployed. Don't call it yourself. If your verticle does things in its shut-down which take some time then you can override this method and call the stopFuture some time later when clean-up is complete. | |
| stop | back to summary |
|---|---|
| public void stop() throws Exception If your verticle has simple synchronous clean-up tasks to complete then override this method and put your clean-up code in here. | |