我主要verticle不同的端口上部署其他verticles:Vert.x中不同端口上的多個Verticle部署集羣環境。問題
public void start(Future<Void> startFuture) throws Exception {
...
final DeploymentOptions frontOptions = new DeploymentOptions()
.setInstances(Configuration.HZ_NB_INSTANCES_NOTIFICATION);
final DeploymentOptions backOptions = new DeploymentOptions()
.setInstances(Configuration.HZ_NB_INSTANCES_NOTIFICATION);
...
ClusterManager mgr = new HazelcastClusterManager();
VertxOptions options = new VertxOptions().setClusterManager(mgr);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
vertx.deployVerticle(WebVerticle.class.getName(), frontOptions,
deployResult -> {
if (deployResult.succeeded()) {
vertx.deployVerticle(SockVerticle.class.getName(),
backOptions , deployResult1 -> {
...
}
}
}
}
凡WebVerticle用於創建一個
Vert.x Web Server
,這將主辦8090的所有靜態文件(HttpServer的)。而SockVerticle用於創建關於8091使用SockJSHandler(HttpServer的)一個EventBus。
有時當我們加載應用程序時,它無法處理eventbus上收到的消息,所以我必須在chrome中進行硬刷新。
我應該創建暴露的HttpServer(8090)的網頁(靜態網頁)兩種不同的fat.jar和暴露的HttpServer(8091)(後端操作)eventbus?