final Random random = new Random();
@Override
public void onMessage(HelixMessageScope scope, UUID messageId, ByteBuf message) {
if (random.nextInt() % 2 == 0) {
HelixAddress sender = firstResolver.getSource(scope);
firstIPC.send(sender, ackMessageType, messageId, null);
}
}
});
firstIPC.start();
// Second IPC service
final HelixIPCService secondIPC =
new NettyHelixIPCService(new NettyHelixIPCService.Config().setInstanceName(
secondNode.getInstanceName()).setPort(secondPort));
secondIPC.registerCallback(messageType, new HelixIPCCallback() {
final Random random = new Random();
@Override
public void onMessage(HelixMessageScope scope, UUID messageId, ByteBuf message) {
if (random.nextInt() % 2 == 0) {
HelixAddress sender = secondResolver.getSource(scope);
secondIPC.send(sender, ackMessageType, messageId, null);
}
}
});
secondIPC.start();