added implementation of HealthCheckResponse
This commit is contained in:
parent
a1db22e5b8
commit
e2b0020484
|
@ -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();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue