如何为主 Verticle 设置 DeploymentOptions

how can I set DeploymentOptions for main verticle

如何设置

DeploymentOptions options = new DeploymentOptions().setWorker(true);

主垂直?

我需要类似的东西

@Override
    public void init(Vertx vertx, Context context) {
        // TODO Auto-generated method stub
        super.init(vertx, context);
    }
  1. 如果您手动部署 Verticle,那么您可以只使用 DeploymentOptions:

    DeploymentOptions options = new DeploymentOptions();
    // <options configuration>
    vertx.deployVerticle("com.mycompany.MyVerticle", options);
    
  2. 如果你使用vertx command line tool,那么vertx run命令可以带几个可选参数。对于你的问题,-worker选项决定了verticle是否是worker verticle。

  3. 如果你使用Vert.xLauncher class, then you can inherit from it and customize some hook methods from VertxLifecycleHooks接口。