updated HealthCheckResponse

This commit is contained in:
Francesco Mangiacrapa 2024-10-16 11:04:36 +02:00
parent deca344022
commit 22bf660710
1 changed files with 4 additions and 19 deletions

View File

@ -11,6 +11,8 @@ import javax.ws.rs.core.Response;
import org.eclipse.microprofile.health.HealthCheck;
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.HealthCheckResponse.Status;
import org.eclipse.microprofile.health.Liveness;
/**
* The Class UriResolverHealthCheck.
@ -28,7 +30,6 @@ public class UriResolverHealthCheck implements HealthCheck {
public Response check() {
HealthCheckResponse hcr = call();
return Response.ok().entity(hcr).build();
}
@ -37,26 +38,10 @@ public class UriResolverHealthCheck implements HealthCheck {
*
* @return the health check response
*/
@Liveness
@Override
public HealthCheckResponse call() {
// return HealthCheckResponse.named("uri-resolver").up().build();
// WORKS in native
return new HealthCheckResponse() {
@Override
public String getName() {
return "uri-resolver";
}
@Override
public Status getStatus() {
return Status.UP;
}
@Override
public Optional<Map<String, Object>> getData() {
return Optional.empty();
}
};
return new HealthCheckResponse("uri-resolver", Status.UP, Optional.empty());
}
}