org.zodiac.actuate.application.internal.AppAvailabilityLivenessHealthChecker Maven / Gradle / Ivy
package org.zodiac.actuate.application.internal;
import org.springframework.boot.actuate.health.Health;
import org.zodiac.actuate.health.checker.LivenessHealthChecker;
import org.zodiac.core.application.availability.AppAvailability;
import org.zodiac.core.application.availability.AppLivenessState;
public class AppAvailabilityLivenessHealthChecker implements LivenessHealthChecker {
public static final String NAME = "app-liveness";
private AppAvailability availability;
public AppAvailabilityLivenessHealthChecker(AppAvailability availability) {
this.availability = availability;
}
@Override
public Health isHealthy() {
AppLivenessState livenessState = availability.getLivenessState();
if (livenessState == AppLivenessState.CORRECT) {
return Health.up().withDetail("info", "The application service instance is set to correct.").build();
} else if (livenessState == AppLivenessState.BROKEN) {
return Health.down().withDetail("info", "The application service instance is broken.").build();
}
return Health.up().build();
}
@Override
public String getName() {
return NAME;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy