Open speedfl opened 3 years ago
/cc @mkouba
We would need to define what "ready" means?
You are right. Like for Angular. We should define life cycle. We could imagine:
I am thinking about other ideas 🤔
@Startup
beans are done?when All Applications coped Beans are Instantiated
@speedfl This is not valid in the context of CDI because @ApplicationScoped
beans are instantiated lazily...
when application can receive traffic
That's a good point. However, it might make more sense to create a specific event for this, e.g. HttpServerStarted
. @stuartwdouglas @gsmet WDYT? In theory, we could fire this event after this line, or?
all @Startup beans are done?
Well, and then we could introduce a new event that will be fired after all observers of this event are notified, etc. ;-).
In fact, you can specify a priority for your observer or a @Startup
bean. Observers with smaller priority are called first. But the truth is that you can only be sure that your observer is notified before the ones with the default priority, which is 2500
.
@mkouba any update on this, I think having an event when it's ready to receive request (health check ready when implemented)
@mkouba any update on this, I think having an event when it's ready to receive request (health check ready when implemented)
That might be an interesting addition to the SR Health extension. WDYT @xstefank
Sure, on top of my head, this should be doable. I'll look.
Description Following logic on lifecycle documentation we can see that we have can register for startup and shuttdown events. It could be useful to have an event when the app is ready.