Deploy multiple verticles with Launcher

496 views
Skip to first unread message

Alexis Hassler

unread,
Mar 21, 2018, 3:51:33 AM3/21/18
to vert.x
Hi,

I would like to start Vert.x with the Launcher in order to have hot redeploy.
AFAIK, the run command can deploy only one verticle, but I would like to have more than one.

My first try was to implement the lifecyle method afterStartingVertx, but it's not called by RunCommand.
The only command that calls back afterStartingVertx, is BareCommand that start Vert.X in cluster mode and does no hot redeploy.

How can I run Vert.x with the Launcher and deploy more than one verticle ?

Julien Viet

unread,
Mar 21, 2018, 4:33:53 AM3/21/18
to ve...@googlegroups.com
Hi,

you need to write a small verticle, that deploys your verticles verticles.

Julien

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/c20ad8a1-4991-4146-a975-c47baf66c0f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Clement Escoffier

unread,
Mar 21, 2018, 4:34:00 AM3/21/18
to ve...@googlegroups.com
Hi,

On 21 Mar 2018, at 08:51, Alexis Hassler <alexis....@gmail.com> wrote:


If you are using the vert.x maven plugin, set the vertx.launcher project property to the FQCN of your Main class. This Main class can just do something like:

Vertx vertx = Vertx.vertx();
vertx.deployVerticle(…);
vertx.deployVerticle(…);
….

The redeployment works in this context.

Clement

Alexis Hassler

unread,
Mar 21, 2018, 5:14:00 AM3/21/18
to vert.x
OK, I'll try it.

BTW, is there a reason why RunCommand does not call afterStartingVertx.

And if the answer is yes, documentation could be enhanced at http://vertx.io/docs/vertx-core/java/#_sub_classing_the_launcher and http://vertx.io/docs/apidocs/io/vertx/core/Launcher.html#afterStartingVertx-io.vertx.core.Vertx-.

Alexis Hassler

unread,
Mar 21, 2018, 5:15:53 AM3/21/18
to vert.x
OK, I'll try it as well.

Is the maven plugin using a specific feature that prevent us of having such hot redeploy in the IDE ?

Clement Escoffier

unread,
Mar 21, 2018, 5:18:59 AM3/21/18
to ve...@googlegroups.com

On 21 Mar 2018, at 10:15, Alexis Hassler <alexis....@gmail.com> wrote:

OK, I'll try it as well.

Is the maven plugin using a specific feature that prevent us of having such hot redeploy in the IDE ?

What do you mean? I just run mvn vertx:run, and that’s all. 

Clement

Clement Escoffier

unread,
Mar 21, 2018, 5:19:17 AM3/21/18
to ve...@googlegroups.com

On 21 Mar 2018, at 10:14, Alexis Hassler <alexis....@gmail.com> wrote:

OK, I'll try it.

BTW, is there a reason why RunCommand does not call afterStartingVertx.

No, it should be called. Can you open an issue?

Clement

Alexis Hassler

unread,
Mar 21, 2018, 6:23:34 AM3/21/18
to vert.x

I checked my code and... there's no issue.

My launcher was broken because I called new Launcher().execute(...) but did not initialize the main field.

Sorry for that.

ste...@digitalstate.ca

unread,
Mar 21, 2018, 6:46:37 AM3/21/18
to vert.x

Here is a example of a initial verticle that does the hit redeploy of the other verticles based on changes to the config file https://github.com/StephenOTT/vertx-yaml-config-verticle-deployment
Reply all
Reply to author
Forward
0 new messages