use of org.infinispan.health.Health in project vertx-openshift-it by cescoffier.
the class EventBusSenderVerticle method setupRouter.
private Router setupRouter() {
Router router = Router.router(vertx);
router.get("/health").handler(rc -> rc.response().putHeader(HttpHeaders.CONTENT_TYPE, "text/plain").end("OK"));
router.get("/ready").handler(HealthCheckHandler.createWithHealthChecks(createHealthChecks()));
router.route("/api/*").handler(ResponseContentTypeHandler.create());
router.route("/api/*").handler(TimeoutHandler.create(API_TIMEOUT));
router.get("/api/start_sending").produces("application/json").handler(rc -> {
timerId = vertx.setPeriodic(10, l -> {
sent.incrementAndGet();
inFlight.incrementAndGet();
sendRequest(2);
});
rc.response().end();
});
router.get("/api/stop_sending").produces("application/json").handler(rc -> {
vertx.cancelTimer(timerId);
waitForAllResponses(ar -> {
JsonObject result = new JsonObject().put("sent", sent.get()).put("failures", failures.get());
rc.response().end(result.toBuffer());
});
});
return router;
}
use of org.infinispan.health.Health in project vertx-openshift-it by cescoffier.
the class EventBusSenderVerticle method createHealthChecks.
private HealthChecks createHealthChecks() {
return HealthChecks.create(vertx).register("ispn-cluster-status", future -> {
VertxInternal vertxInternal = (VertxInternal) vertx;
InfinispanClusterManager clusterManager = (InfinispanClusterManager) vertxInternal.getClusterManager();
EmbeddedCacheManager cacheManager = (EmbeddedCacheManager) clusterManager.getCacheContainer();
Health health = cacheManager.getHealth();
HealthStatus healthStatus = health.getClusterHealth().getHealthStatus();
Status status = new Status().setOk(healthStatus == HealthStatus.HEALTHY).setData(JsonObject.mapFrom(health));
future.complete(status);
});
}
use of org.infinispan.health.Health in project vertx-openshift-it by cescoffier.
the class AsyncMapVerticle method createHealthChecks.
private HealthChecks createHealthChecks() {
return HealthChecks.create(vertx).register("ispn-cluster-status", future -> {
VertxInternal vertxInternal = (VertxInternal) vertx;
InfinispanClusterManager clusterManager = (InfinispanClusterManager) vertxInternal.getClusterManager();
EmbeddedCacheManager cacheManager = (EmbeddedCacheManager) clusterManager.getCacheContainer();
Health health = cacheManager.getHealth();
HealthStatus healthStatus = health.getClusterHealth().getHealthStatus();
Status status = new Status().setOk(healthStatus == HealthStatus.HEALTHY).setData(JsonObject.mapFrom(health));
future.complete(status);
});
}
use of org.infinispan.health.Health in project vertx-openshift-it by cescoffier.
the class EventBusReceiverVerticle method createHealthChecks.
private HealthChecks createHealthChecks() {
return HealthChecks.create(vertx).register("ispn-cluster-status", future -> {
VertxInternal vertxInternal = (VertxInternal) vertx;
InfinispanClusterManager clusterManager = (InfinispanClusterManager) vertxInternal.getClusterManager();
EmbeddedCacheManager cacheManager = (EmbeddedCacheManager) clusterManager.getCacheContainer();
Health health = cacheManager.getHealth();
HealthStatus healthStatus = health.getClusterHealth().getHealthStatus();
Status status = new Status().setOk(healthStatus == HealthStatus.HEALTHY).setData(JsonObject.mapFrom(health));
future.complete(status);
});
}
Aggregations