Vert.x 集群环境中不同端口的多个垂直部署。问题
Multiple Verticle deployement on different port in Vert.x Clustered env. issue
I have Main verticle deploying other verticles on different port:
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 -> {
...
}
}
}
}
Where WebVerticle is used to create a Vert.x Web Server
, it will host all static files on 8090 (httpServer).
And SockVerticle is used to create an EventBus using SockJSHandler on 8091(httpServer).
有时当我们加载应用程序时它无法处理在事件总线上收到的消息,所以我必须在 chrome 中进行硬刷新。
我是否应该为在 httpServer ( 8090 ) 上公开的 Web(静态页面)和在 httpServer ( 8091 ) 上公开的事件总线(后端操作)创建两个不同的 fat.jar?
我必须更新我的 java 聚类参数:
run com.xxx.MainVerticle --launcher-class=io.vertx.core.Launcher --conf=xxx.json -Dvertx.options.blockedThreadCheckInterval=200000000 -Dfile.encoding=UTF-8 -cp . -cluster
I have Main verticle deploying other verticles on different port:
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 -> {
...
}
}
}
}
Where WebVerticle is used to create a
Vert.x Web Server
, it will host all static files on 8090 (httpServer).And SockVerticle is used to create an EventBus using SockJSHandler on 8091(httpServer).
有时当我们加载应用程序时它无法处理在事件总线上收到的消息,所以我必须在 chrome 中进行硬刷新。
我是否应该为在 httpServer ( 8090 ) 上公开的 Web(静态页面)和在 httpServer ( 8091 ) 上公开的事件总线(后端操作)创建两个不同的 fat.jar?
我必须更新我的 java 聚类参数:
run com.xxx.MainVerticle --launcher-class=io.vertx.core.Launcher --conf=xxx.json -Dvertx.options.blockedThreadCheckInterval=200000000 -Dfile.encoding=UTF-8 -cp . -cluster