I think the proposed approach is quite a *classic* but I do not understand what is the best practice to set `VertxOptions` in `public class HttpApplication extends AbstractVerticle {`
What I'm trying:
<!-- language: java -->
import io.vertx.core.AbstractVerticle;
import io.vertx.core.VertxOptions;
public class HttpApplication extends AbstractVerticle {
protected final int DEFAULT_ADDRESS_RESOLUTION_TIMEOUT = 8000;
@Override
public void start(Future<Void> future) {
// [snip] Create a router object and routes
// my custom options code start-here:[
VertxOptions options = new VertxOptions()
.setWarningExceptionTime(1500000000)
.setAddressResolverOptions(new AddressResolverOptions()
.addServer("192.168.0.1")
.addServer("192.168.2.1")
.setMaxQueries(5)
.setCacheNegativeTimeToLive(0) // discard failed DNS lookup results immediately
.setCacheMaxTimeToLive(0) // support DNS based service resolution
.setRotateServers(true)
.setQueryTimeout(DEFAULT_ADDRESS_RESOLUTION_TIMEOUT));
Vertx vertx = Vertx.vertx(options);
// my custom options code: end-here:]
// Create the HTTP server and pass the "accept" method to the request handler.
vertx
.createHttpServer()
.requestHandler(router::accept)
.listen(
in particular I am very doubtful whether it is correct or not to get a vertx in `Vertx vertx = Vertx.vertx(options);` while the gerated code simply uses the *Reference to the Vert.x instance that deployed this verticle* provided by the abstract base class `AbstractVerticle`.
It's my approach safe? has it contraindications or risks breaking something? Is there a better practice to setup my custom `VertxOptions` in `HttpApplication`?