io.vertx.core.spi.cluster.ClusterManager Java Examples

The following examples show how to use io.vertx.core.spi.cluster.ClusterManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Examples.java    From vertx-hazelcast with Apache License 2.0 6 votes vote down vote up
public void customizeDefaultConfig() {
  Config hazelcastConfig = ConfigUtil.loadConfig();

  hazelcastConfig.setClusterName("my-cluster-name");

  ClusterManager mgr = new HazelcastClusterManager(hazelcastConfig);

  VertxOptions options = new VertxOptions().setClusterManager(mgr);

  Vertx.clusteredVertx(options, res -> {
    if (res.succeeded()) {
      Vertx vertx = res.result();
    } else {
      // failed!
    }
  });
}
 
Example #2
Source File: Examples.java    From vertx-hazelcast with Apache License 2.0 6 votes vote down vote up
public void liteMemberConfig() {
  Config hazelcastConfig = ConfigUtil.loadConfig()
    .setLiteMember(true);

  ClusterManager mgr = new HazelcastClusterManager(hazelcastConfig);

  VertxOptions options = new VertxOptions().setClusterManager(mgr);

  Vertx.clusteredVertx(options, res -> {
    if (res.succeeded()) {
      Vertx vertx = res.result();
    } else {
      // failed!
    }
  });
}
 
Example #3
Source File: VxApiLauncher.java    From VX-API-Gateway with MIT License 6 votes vote down vote up
/**
 * 设置vert.x配置
 */
@Override
public void beforeStartingVertx(VertxOptions options) {
	try {
		byte[] bytes = Files.readAllBytes(PathUtil.getPath("conf.json"));
		Buffer buff = Buffer.buffer(bytes);
		// 总配置文件
		JsonObject conf = buff.toJsonObject();
		// vert.x配置文件
		JsonObject vertxc = conf.getJsonObject("vertx", getDefaultVertxConfig());
		initVertxConfig(vertxc, options);
		// 集群配置文件
		JsonObject clusterc = conf.getJsonObject("cluster", new JsonObject().put("clusterType", CLUSTER_TYPE));
		if (!CLUSTER_TYPE.equals(clusterc.getString("clusterType"))) {
			ClusterManager cmgr = VxApiClusterManagerFactory.getClusterManager(clusterc.getString("clusterType"),
					clusterc.getJsonObject("clusterConf", getDefaultClusterConfig()));
			options.setClusterManager(cmgr);
			options.setClustered(true);
		}
	} catch (IOException e) {
		throw new FileSystemException(e);
	}
}
 
Example #4
Source File: Examples.java    From vertx-infinispan with Apache License 2.0 5 votes vote down vote up
public void createClusterManagerProgramatically() {
  ClusterManager mgr = new InfinispanClusterManager();

  VertxOptions options = new VertxOptions().setClusterManager(mgr);

  Vertx.clusteredVertx(options, res -> {
    if (res.succeeded()) {
      Vertx vertx = res.result();
    } else {
      // failed!
    }
  });
}
 
Example #5
Source File: Lifecycle.java    From vertx-infinispan with Apache License 2.0 5 votes vote down vote up
private static InfinispanClusterManager getInfinispanClusterManager(ClusterManager cm) {
  if (cm == null) {
    return null;
  }
  if (cm instanceof InfinispanClusterManager) {
    return (InfinispanClusterManager) cm;
  }
  throw new ClassCastException("Unexpected cluster manager implementation: " + cm.getClass());
}
 
Example #6
Source File: Examples.java    From vertx-ignite with Apache License 2.0 5 votes vote down vote up
public void example3(Ignite ignite) {
  // Configuration code (omitted)

  ClusterManager clusterManager = new IgniteClusterManager(ignite);

  VertxOptions options = new VertxOptions().setClusterManager(clusterManager);
  Vertx.clusteredVertx(options, res -> {
    if (res.succeeded()) {
      Vertx vertx = res.result();
    } else {
      // failed!
    }
  });
}
 
Example #7
Source File: Examples.java    From vertx-ignite with Apache License 2.0 5 votes vote down vote up
public void example1() {
  ClusterManager clusterManager = new IgniteClusterManager();

  VertxOptions options = new VertxOptions().setClusterManager(clusterManager);
  Vertx.clusteredVertx(options, res -> {
    if (res.succeeded()) {
      Vertx vertx = res.result();
    } else {
      // failed!
    }
  });
}
 
Example #8
Source File: Examples.java    From vertx-hazelcast with Apache License 2.0 5 votes vote down vote up
public void example3(HazelcastInstance hazelcastInstance) {
  ClusterManager mgr = new HazelcastClusterManager(hazelcastInstance);
  VertxOptions options = new VertxOptions().setClusterManager(mgr);
  Vertx.clusteredVertx(options, res -> {
    if (res.succeeded()) {
      Vertx vertx = res.result();
    } else {
      // failed!
    }
  });
}
 
Example #9
Source File: AtomixClusteredSharedCounterTest.java    From atomix-vertx with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return helper.createClusterManager();
}
 
Example #10
Source File: EventbusFailureTests.java    From vxms with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}
 
Example #11
Source File: EventbusFailureCircuitBreakerTests.java    From vxms with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}
 
Example #12
Source File: EventbusBlockingChainingObjectTest.java    From vxms with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}
 
Example #13
Source File: WSTimerTest.java    From vert.x-microservice with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
    return new FakeClusterManager();
}
 
Example #14
Source File: RESTJerseyMimeTypeClientTests.java    From vxms with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}
 
Example #15
Source File: RESTAsyncThreadCheck.java    From vxms with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}
 
Example #16
Source File: RESTServiceSelfhostedTest.java    From vxms with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}
 
Example #17
Source File: RESTServiceSelfhostedTestStaticInitializer.java    From vxms with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}
 
Example #18
Source File: RESTServiceChainObjectTest.java    From vxms with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}
 
Example #19
Source File: RESTRouteBuilderPOSTFileClientTests.java    From vxms with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}
 
Example #20
Source File: EventBusServicesTest.java    From vert.x-microservice with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
    return new FakeClusterManager();
}
 
Example #21
Source File: RESTJerseyClientCookieTest.java    From vxms with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}
 
Example #22
Source File: ClusteredSessionHandlerTest.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}
 
Example #23
Source File: RESTJerseyClientEventObjectCircuitBreakerAsyncTest.java    From vxms with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}
 
Example #24
Source File: RESTJerseyClientEventByteCircuitBreakerTest.java    From vxms with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}
 
Example #25
Source File: RESTJerseyClientEventStringCircuitBreakerAsyncTest.java    From vxms with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}
 
Example #26
Source File: RESTJerseyClientEventStringResponseTest.java    From vxms with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}
 
Example #27
Source File: HazelcastHATest.java    From vertx-hazelcast with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new HazelcastClusterManager();
}
 
Example #28
Source File: RESTJerseyClientEventByteResponseTest.java    From vxms with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}
 
Example #29
Source File: ServiceRegistryTest.java    From vert.x-microservice with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
    return new FakeClusterManager();
}
 
Example #30
Source File: StaticPostConstructTest.java    From vxms with Apache License 2.0 4 votes vote down vote up
@Override
protected ClusterManager getClusterManager() {
  return new FakeClusterManager();
}