use of io.vertx.ext.healthchecks.Status 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 io.vertx.ext.healthchecks.Status 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 io.vertx.ext.healthchecks.Status 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);
});
}
use of io.vertx.ext.healthchecks.Status in project hono by eclipse.
the class CacheBasedDeviceConnectionInfo method checkAdapterInstanceId.
private String checkAdapterInstanceId(final String adapterInstanceId, final String tenantId, final String deviceId, final Span span) {
if (adapterInstanceId != null) {
final AdapterInstanceStatus status = adapterInstanceStatusProvider.getStatus(adapterInstanceId);
if (status == AdapterInstanceStatus.DEAD) {
LOG.debug("ignoring found adapter instance id, belongs to already terminated container [tenant: {}, device-id: {}, adapter-instance-id: {}]", tenantId, deviceId, adapterInstanceId);
span.log("ignoring found adapter instance id [" + adapterInstanceId + "], belongs to already terminated container");
cache.remove(getAdapterInstanceEntryKey(tenantId, deviceId), adapterInstanceId).onSuccess(removed -> {
if (removed) {
LOG.debug("removed entry with obsolete adapter instance id '{}' [tenant: {}, device-id: {}]", adapterInstanceId, tenantId, deviceId);
}
}).onFailure(thr -> LOG.debug("error removing entry with obsolete adapter instance id '{}' [tenant: {}, device-id: {}]", adapterInstanceId, tenantId, deviceId, thr));
return null;
} else if (status == AdapterInstanceStatus.SUSPECTED_DEAD) {
LOG.debug("ignoring found adapter instance id, belongs to container with state 'SUSPECTED_DEAD' [tenant: {}, device-id: {}, adapter-instance-id: {}]", tenantId, deviceId, adapterInstanceId);
span.log("ignoring found adapter instance id [" + adapterInstanceId + "], belongs to container with state 'SUSPECTED_DEAD'");
return null;
}
}
return adapterInstanceId;
}
Aggregations