Reputation: 426
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.
Upvotes: 0
Views: 1032
Reputation: 658
This may be about readiness and not necessarily post construction.
To make yourself known to be ready, you could probably implement your own https://quarkus.io/guides/smallrye-health readiness endpoints and let other servers callback your /q/health enpoint
Once all of your enpoints are truly ready as in "UP" string exists and http status code 200 exists, then your app is truly ready.
Upvotes: 0
Reputation: 426
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.
Upvotes: 0