Search code examples
javawildflyresteasymicroprofile

Jakarta EE 10 @Startup on K8S


Stack Java Jakarta EE 10 JBoss/Widlfly 27 Kubernetes K8S JAX-RS (RestEasy)

I want to initialize some caches on startup of my app. During that time i want my readiness probe to respond not ready.

With the management inteface turned on, this works BUT not with my classes, instead the standard one responds.

Wildfly runs in standalone mode.

What i try to accomplish is to run my OWN code for readiness/live BUT that these endpoints are available during startup. I created my own outside of microprofile.healt but they are not available during startup.

Does anybody have some ideas?

Below is my code

import jakarta.enterprise.context.ApplicationScoped;
import org.eclipse.microprofile.health.HealthCheck;
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.Liveness;
import org.eclipse.microprofile.health.Readiness;

/**
 * Created by Gerry Askefalk  on: 2023-01-13
 */
@ApplicationScoped
@Liveness
@Readiness
public class Mycheck implements HealthCheck {

        @Override
        public HealthCheckResponse call() {
            return HealthCheckResponse.named("mycheck").up().build();
        }
}
 

Solution

  • Ok

    the solution (and my bad) was to not add microprofile extensions to WF.

    When i did, it works!

    This article explained it to me.

    microprofile on wf