Vert.x - Main Verticle

Java Conceptuel Diagram

About

A main verticle is a main entry verticle that deploys other verticle.

Example

public class MainVerticle extends AbstractVerticle {

  @Override
  public void start(Promise<Void> promise) {

    // You get the config from the command line
    JsonObject conf = config();
    
    // Deploy database verticle
    Promise<String> dbCompletionHandler = Promise.promise();
    vertx.deployVerticle(new DatabaseVerticle(), dbCompletionHandler);

    // On completion, deploy the http web server 
    // Note id is the deployment id
    dbCompletionHandler.future().compose(
      id -> {

        Promise<String> httpVerticleDeployment = Promise.promise();
        vertx.deployVerticle(
          new VerticleHttpServer(),
          httpVerticleDeployment);

        return httpVerticleDeployment.future();

      }).setHandler(ar -> {   // <7>
      if (ar.succeeded()) {
        promise.complete();
      } else {
        promise.fail(ar.cause());
      }
    });

  }
}





Discover More
Java Conceptuel Diagram
Vert.x - Fat Jar with Vertx Launcher

How to create a fat jar that wraps the vert.x launcher or a custom launcher to be able to use its commands With the launcher as the main class in a fat jar, Once the launcher is wrapped, you can...
Vertx Launcher Idea Run
Vert.x - Launcher class

The io/vertx/core/LauncherVertx launcher is one of the two way to start an application It is a launcher class that wraps the management of a vertx instance and the deployment of a main verticle. It can...
Java Conceptuel Diagram
Vert.x - The launcher run command

The run command (Code) is a command of the launcher. It will: create a instance...
Java Conceptuel Diagram
Vert.x - Verticle

Verticles are the technical units of deployments of code in Vert.x. Verticles share certain similarities with actors in the actor model. Verticles communicate with each other by generating messages...
Vertx Verticle And Lib
Vertx - Distribution Deployment

Distribution deployment is the deployment of a verticle that is based on the availability of a vertx distribution Get the Vert.x distribution Create a distribution of your application that contains:...



Share this page:
Follow us:
Task Runner