1
votes

I am new to vert.x. I'm not looking for code snippets/examples as the vert.x github page is full of them.

I'm looking for some facts and best practices.

I am coding an application that its main verticle is a HttpServer which handles Restful requests.

I package the application using maven shade plugin as it is describe here: http://vertx.io/blog/my-first-vert-x-3-application/

<manifestEntries>
  <Main-Class>io.vertx.core.Starter</Main-Class>
  <Main-Verticle>io.vertx.blog.first.MyFirstVerticle</Main-Verticle>
</manifestEntries>

First question:

Is there any difference between different ways to run the app:

  1. Run using java -jar app-fat.jar
  2. vertx run MyApp.java
  3. Any other way... ?

Second question:

As the number of users requests goes high, do I need to do anything or vert.x will scale and create more instances of my HttpServer verticle?

Third question:

Let say one of my REST handlers delegates its task to another verticle, for example a verticle that does database related tasks. How should I deploy that verticle? from maven? from the HttpServer verticle? Which way is the best practice?

1
Split your question. - poiuytrez

1 Answers

2
votes
  1. It only depends on the way you publish your verticles. I use fat JARs, so I recommend you the first option. The second option (vertx run MyApp.java) originates from Vert.x 2 for which fat JARs weren't recommended.

  2. You need to specify the number of verticles before the deployment. I don't know about any of tools which can help adjusting the number of running verticles. You just need to do that by hand.

  3. It's a good practice to create a separate verticle which will deploy all of the verticles you need. I might recommend you to use https://github.com/vert-x3/vertx-service-factory and create a config which will contain service definitions you want to run.