Browse Source

Changed health check to verify the entry point of the OParl service returns data

master
Jim Martens 10 months ago
parent
commit
cd8fbab752
  1. 12
      oparl-server/src/main/java/de/twomartens/oparlservice/actuator/RestHealthCheck.java

12
oparl-server/src/main/java/de/twomartens/oparlservice/actuator/RestHealthCheck.java

@ -1,6 +1,6 @@
package de.twomartens.oparlservice.actuator;
import de.twomartens.oparlservice.entity.Greeting;
import de.twomartens.oparlservice.entity.System;
import de.twomartens.oparlservice.interceptors.RequestTypeInterceptor;
import de.twomartens.oparlservice.interceptors.TraceIdInterceptor;
import lombok.extern.slf4j.Slf4j;
@ -34,12 +34,12 @@ public class RestHealthCheck extends AbstractHealthCheck implements HealthIndica
@Override
boolean isEndpointAvailable() {
try {
ResponseEntity<Greeting> result = restTemplate.getForEntity(getEndpoint(), Greeting.class);
Greeting body = result.getBody();
ResponseEntity<System> result = restTemplate.getForEntity(getEndpoint(), System.class);
System body = result.getBody();
if (body == null) {
return false;
}
return !body.getMessage().isEmpty();
return !body.getId().isEmpty();
} catch (RestClientException e) {
return false;
}
@ -47,10 +47,10 @@ public class RestHealthCheck extends AbstractHealthCheck implements HealthIndica
@Override
String getMethodName() {
return "template-service-rest";
return "oparl-service-rest";
}
String mkEndpoint() {
return String.format("http://%s:%d/greeting?name=RestHealthCheck", getHost(), getPort());
return String.format("http://%s:%d/v1.1/", getHost(), getPort());
}
}
Loading…
Cancel
Save