updated for health api
This commit is contained in:
parent
5a771aeeb5
commit
57d25b3ed3
10
pom.xml
10
pom.xml
|
@ -233,16 +233,6 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<!-- version>2.15</version -->
|
|
||||||
<configuration>
|
|
||||||
<!-- tomcat annotation discovery won't work with the default manifest-only
|
|
||||||
jar -->
|
|
||||||
<useManifestOnlyJar>false</useManifestOnlyJar>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class HealthTask extends TimerTask{
|
||||||
try {
|
try {
|
||||||
return check.check();
|
return check.check();
|
||||||
}catch (Throwable t) {
|
}catch (Throwable t) {
|
||||||
return HealthCheckResponse.builder(check.getName()).down().withMessage(t.getMessage()).build();
|
return HealthCheckResponse.builder(check.getName()).down().error(t.getMessage()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,10 @@ public class KeyCloakHealthCheck implements HealthCheck{
|
||||||
try {
|
try {
|
||||||
Set<String> contexts = ProviderFactory.provider().containerContext().authorizationProvider().getContexts();
|
Set<String> contexts = ProviderFactory.provider().containerContext().authorizationProvider().getContexts();
|
||||||
if (contexts.isEmpty())
|
if (contexts.isEmpty())
|
||||||
return HealthCheckResponse.builder(CHECK_NAME).down().withMessage("no contexts are defined for the client id provided").build();
|
return HealthCheckResponse.builder(CHECK_NAME).down().error("no contexts are defined for the client id provided").build();
|
||||||
return HealthCheckResponse.builder(CHECK_NAME).up().build();
|
return HealthCheckResponse.builder(CHECK_NAME).up().info(String.format("running contexts are %s", contexts)).build();
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
return HealthCheckResponse.builder(CHECK_NAME).down().withMessage(e.getMessage()).build();
|
return HealthCheckResponse.builder(CHECK_NAME).down().error(e.getMessage()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue