Vert.x - Launcher class

Java Conceptuel Diagram

About

The Vertx 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 be used:

This class is used as the main class and wrapped by:

Ide Configuration

Idea Run

For instance to run a verticle in IDEA, you would configure this run.

Vertx Launcher Idea Run

Implementation

docs/apidocs/io/vertx/core/Launcher.html can be seen as a standard version of a main class

Custom

You may extends the launcher to execute code at some lifecycle endpoints (before/after creating a vertx, before/after verticle deployment)

See Vertx - Launcher extension (Custom launcher)

Command

Commands

  • run - Start a Vert.x instance and deploy a verticle
  • start - Start a Vertx application in the background
  • stop - Stop a background application
  • list - List the background application

Run

Vert.x - The launcher run command

Start

java -jar my-verticle-fat.jar start --vertx-id=my-app-name

where:

  • vertx-id : the application id, uses a random UUID if not set
  • java-opts : the Java Virtual Machine options, uses the JAVA_OPTS environment variable if not set. As the start command spawns a new process, the java options passed to the JVM are not propagated, so you must use java-opts to configure the JVM (-X, -D…​).
  • redirect-output : redirect the spawned process output and error streams to the parent process streams.

Stop

java -jar my-verticle-fat.jar stop my-app-name

List

java -jar my-verticle-fat.jar list





Discover More
Java Conceptuel Diagram
Vert.x - Application Start - (Entry|Start) point

A main entry of a vert.x application will start a vertx instance and deploy one or several verticle in it. You have two methods to start an application a main class or the launcher - The is an advanced...
Java Conceptuel Diagram
Vert.x - Blocking Code

This page is blocking code in Vert.x that will block the event loop. By default, blocking code is executed on the Vert.x worker pool. promise can be composed, the database start first, then the...
Java Conceptuel Diagram
Vert.x - Docker

Docker as a distribution unit to distribute an run a vert.x application Example: where: anapsix/alpine-java is the java alpine image vertx-application-fat.jar...
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...
Java Conceptuel Diagram
Vert.x - High availability deployment (HA)

When a verticle is deployed in High availability mode, it can fail over to any other nodes in the cluster started with the same HA group The HA mode can be defined in a run or start command A...
Java Conceptuel Diagram
Vert.x - Hot reloading / Live redeploy

This page is Hot reload in Vert.x On matching file changes, the process is stopped and the application is restarted. Live redeploy with the vertx command of: a verticle with the launcher...
Java Conceptuel Diagram
Vert.x - Logger

logging in Vertx is managed by the Vertx Logger The Vertx logger is a facade for logging system. It uses the JUL logger as default logging...
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...
Java Conceptuel Diagram
Vert.x - vertx command line

vertx is a command line utility tool that call the launcher class Vertx instance You get it with the full distribution where: bare resolve run As the vertx command is a wrapper...



Share this page:
Follow us:
Task Runner