Change readiness to liveness for default health check #46224
-
Is it possible to change or add liveness check to an existing readiness check? I created a "CustomHealthCheck" bean that inherits from DataSourceHealthCheck. That works just fine, but I would like to know if there is a better way to do this. @ApplicationScoped
@Liveness
class CustomHealthCheck : DataSourceHealthCheck() |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
/cc @geoand (kotlin), @jmartisk (health), @xstefank (health) |
Beta Was this translation helpful? Give feedback.
-
you can use health registries for this but I don't think you can remove it from readiness. But you can add it to liveness like this: @ApplicationScoped
public class StartObserver {
@Inject
@Readiness
DataSourceHealthCheck healthCheck;
public void observeStart(@Observes StartupEvent startupEvent) {
HealthRegistries.getRegistry(HealthType.LIVENESS).register(healthCheck);
}
} |
Beta Was this translation helpful? Give feedback.
Hi @stephan-strate
you can use health registries for this but I don't think you can remove it from readiness. But you can add it to liveness like this: