Verticle
interface.See: Description
Verticle
interface.
They can implement it directly if you like but usually it's simpler to extend
the abstract class AbstractVerticle
.
Here's an example verticle:
----
public class MyVerticle extends AbstractVerticle {
// Called when verticle is deployed
public void start() {
}
// Optional - called when verticle is undeployed
public void stop() {
}
}
----
Normally you would override the start method like in the example above.
When Vert.x deploys the verticle it will call the start method, and when the method has completed the verticle will
be considered started.
You can also optionally override the stop method. This will be called by Vert.x when the verticle is undeployed and when
the method has completed the verticle will be considered stopped.
=== Asynchronous Verticle start and stop
Sometimes you want to do something in your verticle start-up which takes some time and you don't want the verticle to
be considered deployed until that happens. For example you might want to deploy other verticles in the start method.
You can't block waiting for the other verticles to deploy in your start method as that would break the <Copyright © 2015. All Rights Reserved.