We were trying to establish communication between verticles using event bus. We tried the simplest ping-pong communication example -
public class Sender extends AbstractVerticle {
public static void main(String[] args) {
Vertx.clusteredVertx(new VertxOptions(),res->{
res.result().deployVerticle(new Sender());
});
}
@Override
public void start() throws Exception {
EventBus eb = vertx.eventBus();
vertx.setPeriodic(1000, v -> {
eb.send("ping-address", "ping!", reply -> {
if (reply.succeeded()) {
System.out.println("Received reply: " + reply.result().body());
} else {
System.out.println("No reply");
}
});
});
}
}
Similarly we wrote the wrote the receiver. See the code.
Communication is successful if both the sender and receiver are run on the same machine. But when they are run different machines communication fails. Also this does not seems to be the issue with Hazelcast Cluster manager (which we used) because hazelcast correctly discovers the other peer on both machine (this is evident from the console logs of hazelcast).
Members [2] {
Member [192.168.43.12]:5701
Member [192.168.43.84]:5701 this
}
Also firewall has not been enabled on both machines, and we were able to establish communication between the same machines using only hazelcast(without using vertx), and it worked perfectly (for example this). So probably the issue is with vert-x.