HazelcastClusterManager clusterManager = new HazelcastClusterManager(hazelcast);
VertxOptions opts = new VertxOptions()
.setClusterManager(clusterManager)
.setClusterHost(ConfigurationManager.EB_CLUSTER_HOST)
.setClusterPort(ConfigurationManager.EB_CLUSTER_PORT);
return Vertx.rxClusteredVertx(opts);
Hey guys,I am a member of a team working on Java project with client-server architecture. Some time ago we switched to vert.x on server-side and used vertx-tcp-eventbus-bridge to connect it with clients (we had our own's Java Bridge Client implementation as there is no official one yet). But shortly after, we switched to clustered vert.x with Hazelcast. As our client-server approach isn't exactly what Hazelcast cluster stands for, we decided to use Hazelcast clients as they seemed to be what we needed.
The problem we encountered and I wanted to ask you for help is configuration of cluster-host option in client application.
On Thursday, 27 April 2017 09:29:41 UTC+1, przemyslaw...@connectpoint.pl wrote:Hey guys,I am a member of a team working on Java project with client-server architecture. Some time ago we switched to vert.x on server-side and used vertx-tcp-eventbus-bridge to connect it with clients (we had our own's Java Bridge Client implementation as there is no official one yet). But shortly after, we switched to clustered vert.x with Hazelcast. As our client-server approach isn't exactly what Hazelcast cluster stands for, we decided to use Hazelcast clients as they seemed to be what we needed.I'm not sure I understand what you mean here. Could you explain in some more detail?
ClasspathXmlConfig hazelcastConfig = new ClasspathXmlConfig(HAZELCAST_CONFIG_URL);
HazelcastClusterManager clusterManager = new HazelcastClusterManager(hazelcastConfig);
VertxOptions opts = new VertxOptions().setClusterManager(clusterManager)
.setClusterHost(ConfigurationManager.EB_CLUSTER_HOST)
.setClusterPort(ConfigurationManager.EB_CLUSTER_PORT);
Vertx.rxClusteredVertx(opts).doOnError(throwable -> log.fatal("Failed to create clustered vert.x!", throwable))
.doOnSuccess(this::deploy).subscribe();
The problem we encountered and I wanted to ask you for help is configuration of cluster-host option in client application.Which client application are you referring to?
It seems that even if Hazelcast connects successfully this value is not "passed on" from Hazelcast connection but is required to be filled explicitly. I would like to use the same host as the Hazelcast is using and not need to provide it explicitly.Currently, it looks like that:HazelcastClusterManager clusterManager = new HazelcastClusterManager(hazelcast);
VertxOptions opts = new VertxOptions()
.setClusterManager(clusterManager)
.setClusterHost(ConfigurationManager.EB_CLUSTER_HOST)
.setClusterPort(ConfigurationManager.EB_CLUSTER_PORT);
return Vertx.rxClusteredVertx(opts);Best,Przemek
On Thursday, 27 April 2017 11:02:01 UTC+2, Tim Fox wrote:
On Thursday, 27 April 2017 09:29:41 UTC+1, przemyslaw...@connectpoint.pl wrote:Hey guys,I am a member of a team working on Java project with client-server architecture. Some time ago we switched to vert.x on server-side and used vertx-tcp-eventbus-bridge to connect it with clients (we had our own's Java Bridge Client implementation as there is no official one yet). But shortly after, we switched to clustered vert.x with Hazelcast. As our client-server approach isn't exactly what Hazelcast cluster stands for, we decided to use Hazelcast clients as they seemed to be what we needed.I'm not sure I understand what you mean here. Could you explain in some more detail?We have a single server side application (running on a separate VM) with multiple client applications connecting to it. For communication we use clustered vert.x with Hazelcast. The cluster currently consists of only one member (server side application). Client side applications connects as cluster clients
to this specific cluster member. All the communication between server and clients is via Event Bus.
On Thursday, 27 April 2017 10:35:25 UTC+1, przemyslaw...@connectpoint.pl wrote:
On Thursday, 27 April 2017 11:02:01 UTC+2, Tim Fox wrote:
On Thursday, 27 April 2017 09:29:41 UTC+1, przemyslaw...@connectpoint.pl wrote:Hey guys,I am a member of a team working on Java project with client-server architecture. Some time ago we switched to vert.x on server-side and used vertx-tcp-eventbus-bridge to connect it with clients (we had our own's Java Bridge Client implementation as there is no official one yet). But shortly after, we switched to clustered vert.x with Hazelcast. As our client-server approach isn't exactly what Hazelcast cluster stands for, we decided to use Hazelcast clients as they seemed to be what we needed.I'm not sure I understand what you mean here. Could you explain in some more detail?We have a single server side application (running on a separate VM) with multiple client applications connecting to it. For communication we use clustered vert.x with Hazelcast. The cluster currently consists of only one member (server side application). Client side applications connects as cluster clientsNot sure what you mean by "cluster clients" here. Do you mean that your clients use hazelcast directly (not Vert.x) ?
ClientConfig hazelcastConf = new XmlClientConfigBuilder(HAZELCAST_CLIENT_CONFIG_URL).build();
hazelcast = HazelcastClient.newHazelcastClient(hazelcastConf);
HazelcastClusterManager clusterManager = new HazelcastClusterManager(hazelcast);
VertxOptions opts = new VertxOptions()
.setClusterManager(clusterManager)
.setClusterHost(ConfigurationManager.EB_CLUSTER_HOST) // I want the cluster host to be the same value as the one// used by Hazelcast, not to set it explicitly here
.setClusterPort(ConfigurationManager.EB_CLUSTER_PORT);
return Vertx.rxClusteredVertx(opts);
<network>
<cluster-members>
<address>server-host:port</address>
</cluster-members>
</network>
The default hostname to use when clustering is "localhost" (http://vertx.io/docs/apidocs/io/vertx/core/VertxOptions.html#DEFAULT_CLUSTER_HOST), so it seems Vert.x doesn't put much effort into discovering network interfaces.
In case of Hazelcast Client config I don't have to specify the interface nor hostname to be used, only the cluster member address which is very convenient.<network>
<cluster-members>
<address>server-host:port</address>
</cluster-members>
</network>Hazelcast figures out the proper network interface (and hostname) during runtime.
On Thursday, 27 April 2017 12:35:19 UTC+1, przemyslaw.kuczynski@connectpoint.pl wrote:The default hostname to use when clustering is "localhost" (http://vertx.io/docs/apidocs/io/vertx/core/VertxOptions.html#DEFAULT_CLUSTER_HOST), so it seems Vert.x doesn't put much effort into discovering network interfaces.When running with Starter Vert.x uses this code to select an interface:which basically selects the first non local, non multicast interface.In case of Hazelcast Client config I don't have to specify the interface nor hostname to be used, only the cluster member address which is very convenient.<network>
<cluster-members>
<address>server-host:port</address>
</cluster-members>
</network>Hazelcast figures out the proper network interface (and hostname) during runtime.But there is no such thing as a "proper network interface". It's common for machines to be configured with multiple interfaces and in that case there is no way for either Hazelcast or Vert.x to know which one you want to use, or maybe you want to use different ones for hazelcast and Vert.x :)Point is, you can't get away from configuring it in the general case as neither Vert.x nor Hazelcast can do magic.In this case I will try to extract the hostname from Hazelcast and pass it to VertxOptions.
I don't want to set it as a system property or environment variable as I don't know what hostname to use at launch time of the client side application. It would be great if setting hostname to "0.0.0.0" would work.