Search in sources :

Example 1 with ZookeeperClusterManager

use of io.vertx.spi.cluster.zookeeper.ZookeeperClusterManager in project vertx-examples by vert-x3.

the class MainClassNode1 method main.

public static void main(String[] args) {
    JsonObject zkConfig = configureClusterManager();
    ClusterManager zookeeperClusterManager = new ZookeeperClusterManager(zkConfig);
    VertxOptions options = configureVertx(zookeeperClusterManager);
    Vertx.clusteredVertx(options, res -> {
        if (res.succeeded()) {
            Vertx vertx = res.result();
            DeploymentOptions deploymentOptions = new DeploymentOptions().setInstances(2);
            vertx.deployVerticle("verticle.SenderVerticle", deploymentOptions);
            System.out.println("Sender verticle deployed");
        }
    });
}
Also used : DeploymentOptions(io.vertx.core.DeploymentOptions) ZookeeperClusterManager(io.vertx.spi.cluster.zookeeper.ZookeeperClusterManager) JsonObject(io.vertx.core.json.JsonObject) Vertx(io.vertx.core.Vertx) ZookeeperClusterManager(io.vertx.spi.cluster.zookeeper.ZookeeperClusterManager) ClusterManager(io.vertx.core.spi.cluster.ClusterManager) VertxOptions(io.vertx.core.VertxOptions)

Example 2 with ZookeeperClusterManager

use of io.vertx.spi.cluster.zookeeper.ZookeeperClusterManager in project vertx-examples by vert-x3.

the class MainClassNode2 method main.

public static void main(String[] args) {
    JsonObject zkConfig = configureClusterManager();
    ClusterManager zookeeperClusterManager = new ZookeeperClusterManager(zkConfig);
    VertxOptions options = configureVertx(zookeeperClusterManager);
    Vertx.clusteredVertx(options, res -> {
        if (res.succeeded()) {
            Vertx vertx = res.result();
            DeploymentOptions deploymentOptions = new DeploymentOptions().setInstances(2);
            vertx.deployVerticle("verticle.ConsumerVerticle", deploymentOptions);
            System.out.println("consumer verticle deployed");
        }
    });
}
Also used : DeploymentOptions(io.vertx.core.DeploymentOptions) ZookeeperClusterManager(io.vertx.spi.cluster.zookeeper.ZookeeperClusterManager) JsonObject(io.vertx.core.json.JsonObject) Vertx(io.vertx.core.Vertx) ZookeeperClusterManager(io.vertx.spi.cluster.zookeeper.ZookeeperClusterManager) ClusterManager(io.vertx.core.spi.cluster.ClusterManager) VertxOptions(io.vertx.core.VertxOptions)

Aggregations

DeploymentOptions (io.vertx.core.DeploymentOptions)2 Vertx (io.vertx.core.Vertx)2 VertxOptions (io.vertx.core.VertxOptions)2 JsonObject (io.vertx.core.json.JsonObject)2 ClusterManager (io.vertx.core.spi.cluster.ClusterManager)2 ZookeeperClusterManager (io.vertx.spi.cluster.zookeeper.ZookeeperClusterManager)2