Skip to content

Reacting to state changes of health checks? #36918

Answered by xstefank
nscuro asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @nscuro. Not sure I understand what you're after. But all HCs are CDI beans. So is this what you mean?

package org.acme;

import io.quarkus.agroal.runtime.health.DataSourceHealthCheck;
import io.smallrye.health.api.HealthGroup;
import org.eclipse.microprofile.health.HealthCheckResponse;

@HealthGroup("testHC")
public class ExtendedDBHC extends DataSourceHealthCheck {

    @Override
    public HealthCheckResponse call() {
        HealthCheckResponse result = super.call();
        if (result.getStatus().equals(HealthCheckResponse.Status.DOWN)) {
            System.out.println("Send message here");
        }
        return result;
    }
}

@HealthGroup("testHC") because I don't want it to…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@xstefank
Comment options

xstefank Nov 7, 2023
Collaborator

@nscuro
Comment options

Answer selected by nscuro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants