本文整理匯總了Java中io.vertx.core.Vertx.clusteredVertx方法的典型用法代碼示例。如果您正苦於以下問題:Java Vertx.clusteredVertx方法的具體用法?Java Vertx.clusteredVertx怎麽用?Java Vertx.clusteredVertx使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.vertx.core.Vertx
的用法示例。
在下文中一共展示了Vertx.clusteredVertx方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import io.vertx.core.Vertx; //導入方法依賴的package包/類
public static void main(String... args) {
//Note to self
// run this demo in HA mode, deploy this verticle on a separate node and combine it with demo6
final JsonObject config = Config.fromFile("config/demo7.json");
VertxOptions opts = new VertxOptions().setClustered(true);
Vertx.clusteredVertx(opts, result -> {
if (result.succeeded()) {
LOG.info("Cluster running");
Vertx vertx = result.result();
vertx.deployVerticle(BitcoinAdjustedData.class.getName(),
new DeploymentOptions().setConfig(config).setWorker(false));
} else {
LOG.error("Clusterin failed");
throw new RuntimeException(result.cause());
}
});
}
示例2: main
import io.vertx.core.Vertx; //導入方法依賴的package包/類
public static void main(String... args) {
final JsonObject config = Config.fromFile("config/demo6.json");
Vertx vertx = Vertx.vertx();
vertx.deployVerticle(new JSPercentilesDatasource(), new DeploymentOptions().setConfig(config));
/*
Vertx vertx = Vertx.vertx();
vertx.deployVerticle(new JSAggregateDatasource(), new DeploymentOptions().setConfig(config));
*/
VertxOptions opts = new VertxOptions().setClustered(true);
Vertx.clusteredVertx(opts, result -> {
if(result.succeeded()){
LOG.info("Cluster running");
Vertx cvertx = result.result();
cvertx.deployVerticle(new JSPercentilesDatasource(), new DeploymentOptions().setConfig(config));
} else {
LOG.error("Clustering failed");
throw new RuntimeException(result.cause());
}
});
}
示例3: main
import io.vertx.core.Vertx; //導入方法依賴的package包/類
public static void main(String... args) {
final JsonObject config = Config.fromFile("config/demo6.json");
/*
Vertx vertx = Vertx.vertx();
vertx.deployVerticle(new JSAggregateDatasource(), new DeploymentOptions().setConfig(config));
*/
VertxOptions opts = new VertxOptions().setClustered(true);
Vertx.clusteredVertx(opts, result -> {
if(result.succeeded()){
LOG.info("Cluster running");
Vertx vertx = result.result();
vertx.deployVerticle(new JSAggregateDatasource(), new DeploymentOptions().setConfig(config));
} else {
LOG.error("Clustering failed");
throw new RuntimeException(result.cause());
}
});
}
示例4: main
import io.vertx.core.Vertx; //導入方法依賴的package包/類
public static void main(String... args) {
VertxOptions options = new VertxOptions().setClustered(true)
.setHAEnabled(true)
.setHAGroup("dev");
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
Vertx vertx = res.result();
deployVerticles(vertx);
LOG.info("Vertx Cluster running");
} else {
LOG.error("Creating Vertx cluster failed", res.cause());
}
});
}
示例5: createVertx
import io.vertx.core.Vertx; //導入方法依賴的package包/類
@Override
protected Vertx createVertx() {
try {
CompletableFuture<Vertx> future = new CompletableFuture<>();
log.info("Creating clustered Vertx...");
Vertx.clusteredVertx(vertxOptions(), ar -> {
if (ar.succeeded()) {
log.info("Vertx creation is completed!");
future.complete(ar.result());
} else {
log.error("Vertx creation failed!", ar.cause());
future.completeExceptionally(ar.cause());
}
});
return future.get();
} catch (Exception e) {
log.error("Clustered Vertx creation failed", e);
throw new RuntimeException(e);
}
}
示例6: main
import io.vertx.core.Vertx; //導入方法依賴的package包/類
public static void main(String... args) {
VertxOptions options = new VertxOptions().setClustered(true)
.setHAEnabled(true)
.setHAGroup("dev");
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
Vertx vertx = res.result();
deployVerticles(vertx);
LOG.info("Vertx Cluster running");
} else {
LOG.error("Creating Vertx cluster failed", res.cause());
}
});
}