Vertx - Launcher extension (Custom launcher)

About

The launcher has several lifecycle methods that you can override in order to add custom code that provide a way to configure the options:

  • for the creation of a vertx
  • or for the deployment of a verticle

Example

If we want to set some metrics, we could extends the launcher and override the method beforeStartingVertx

public class Launcher extends io.vertx.core.Launcher {


  @Override
  public void beforeStartingVertx(VertxOptions options) {

    options.setMetricsOptions(DropWizard.getMetricsOptions());

  }

  public static void main(String[] args) {

    new Launcher().dispatch(args);

  }

}

Idea

In a IDE such as IDEA, you can then create a Run configuration with the launcher as a main class.

_

Documentation / Reference


Powered by ComboStrap