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

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

Go to download

Java library for consuming HAL+JSON feeds (https://github.com/qmetric/hal-feed-server)

There is a newer version: 3.18
Show newest version
package com.qmetric.feed.consumer.metrics;

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

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 FeedTracker feedTracker;

    public ConsumedStoreConnectivityHealthCheck(final FeedTracker feedTracker)
    {
        this.feedTracker = feedTracker;
    }

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

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy