Vertx - Launcher extension (Custom launcher)

Java Conceptuel Diagram

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.

Vertx Launcher Extension Custom Idea Run

Documentation / Reference





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 - Metrics

in Vertx. By default Vert.x does not record any metrics. Instead it provides an SPI for others to implement which can be added to the classpath. The metrics SPI is an advanced feature which allows implementers...
Java Conceptuel Diagram
Vert.x - The launcher run command

The run command (Code) is a command of the launcher. It will: create a instance...



Share this page:
Follow us:
Task Runner