简体   繁体   English

Jakarta EE 10 @Startup on K8S

[英]Jakarta EE 10 @Startup on K8S

Stack Java Jakarta EE 10 JBoss/Widlfly 27 Kube.netes K8S JAX-RS (RestEasy)堆栈 Java Jakarta EE 10 JBoss/Widlfly 27 Kube.netes 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. Wildfly 以独立模式运行。

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.我在 microprofile.healt 之外创建了自己的,但它们在启动期间不可用。

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();
        }
}
 

Ok

the solution (and my bad) was to not add microprofile extensions to WF.解决方案(也是我的坏处)是不向 WF 添加 microprofile 扩展。

When i did, it works!当我这样做时,它有效!

This article explained it to me.这篇文章向我解释了它。

microprofile on wf wf 上的微档案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM