I\'m developing in Vert.x (based on Netty and Hazelcast), and I\'m trying to share data between two server instances (eache of those instances in different machines, on the same
There are options for sharing data among vertx instances on different machines
Option 1.
You could use the Vert.x ClusterManager and it's maps:
ClusterManager clusterManager = ((VertxInternal)vertx).clusterManager();
Map map = clusterManager.getSyncMap("mapName"); // shared distributed map
That map is backed by a Hazelcast IMap and is distributed. This assumes you're running vertx with the -cluster
parameter and have configured clustering.
However note that this is internal API and is not generally recommended for production. If you are doing a one time experiment then it could be useful.
Option 2.
You can get access to Hazelcast once vertx is started in clustered mode:
Set instances = Hazelcast.getAllHazelcastInstances();
HazelcastInstance hz = instances.stream().findFirst().get();
Map map = hz.getMap("mapName"); // shared distributed map