All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.qmetric.feed.consumer.metrics.ConsumedStoreConnectivityHealthCheck Maven / Gradle / Ivy

package com.qmetric.feed.consumer.metrics;

import com.codahale.metrics.health.HealthCheck;
import com.qmetric.feed.consumer.store.ConsumedStore;

import static com.codahale.metrics.health.HealthCheck.Result.healthy;
import static com.codahale.metrics.health.HealthCheck.Result.unhealthy;

public class ConsumedStoreConnectivityHealthCheck extends HealthCheck
{
    private final ConsumedStore consumedStore;

    public ConsumedStoreConnectivityHealthCheck(final ConsumedStore consumedStore)
    {
        this.consumedStore = consumedStore;
    }

    @Override protected Result check() throws Exception
    {
        try
        {
            consumedStore.checkConnectivity();

            return healthy("Consumed store connectivity is healthy");
        }
        catch (final Exception exception)
        {
            return unhealthy(exception);
        }
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy