The code consists in deploying 1 instance of WikiDatabaseVerticle
and 2 instances of HttpServerVerticle
:
Deploying a verticle is an asynchronous operation, so we need a for that. The
String
parametric type is because a verticle gets an identifier when successfully deployed.Sequential composition with
compose
allows to run one asynchronous operation after the other. When the initial future completes successfully, the composition function is invoked.We define a handler that eventually completes the
MainVerticle
start future.
There is no need to do that with Vert.x as multiple verticles can share the same TCP ports. Incoming connections are simply distributed in a round-robin fashion from accepting threads.