Home > Enterprise >  How to run code in quarkus once all rest services are deployt (reachable)?
How to run code in quarkus once all rest services are deployt (reachable)?

Time:02-18

I am writing a quarkus that makes itself known to other servers. Those other servers then want to use my resources.

This fails, because I inform them about the quarkus startup before my own services are actually available.

I currently use

void onStart(@Observes StartupEvent ev) { ... }

to run code at startup.

But this triggers before of my rest services are available.

How can I execute Code in quarkus after everything in this quarkus instance is "ready" to be used?

I am looking basically for a: "EveryThingIsReadyEvent" I can observe.

CodePudding user response:

Use @PostConstruct method in your REST resource bean.

CodePudding user response:

What we do now is we start a thread in the onStartup and there we call the ApplicationLifecycleManager and use the "waitForApplicationStart()" Method.

At that point everything that runs after is started.

  • Related