added implementation of HealthCheckResponse

This commit is contained in:
Francesco Mangiacrapa 2024-10-15 17:08:42 +02:00
parent a1db22e5b8
commit e2b0020484
1 changed files with 36 additions and 10 deletions

View File

@ -1,25 +1,51 @@
package org.gcube.datatransfer.resolver.services;
import java.util.Map;
import java.util.Optional;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import org.eclipse.microprofile.health.HealthCheck;
import org.eclipse.microprofile.health.HealthCheckResponse;
/**
* The Class UriResolverHealthCheck.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 15, 2024
*/
@Path("health")
public class UriResolverHealthCheck implements HealthCheck {
@Override
/**
* Index.
/**
* Call.
*
* @param req the req
* @return the input stream
* @throws WebApplicationException the web application exception
* @return the health check response
*/
@Override
@GET
@Path("")
public HealthCheckResponse call() {
return HealthCheckResponse.named("uri-resolver").up().build();
}
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();
}
};
}
}