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
With Vert.x 3 - if you configure your Vert.x instances into "clustered mode" (which can be as simple as adding -cluster
to the command line of the Vert.x launcher, see here for details), then you can use the SharedData interface to get access to "distributed maps" which allows cluster members to read and write data across the cluster transparently.
Example:
if (vertx.isClustered()) {
log.info("Using clustered data store");
vertx.sharedData().getClusterWideMap("entities",
res -> {
AsyncMap dataMap = res.result();
setDataStore(dataMap);
});
}