I am implementing a Quarkus server. On server start, a (never ending) background process should be started.
I know I can observe the start event with an @ApplicationScoped
bean which implements:
void onStart(@Observes StartupEvent ev)
.
But what is the best way to start a background process? Are there restrictions?
In J2EE one should not create Threads, but use ManagedExecutorService
or an EJB with a @Asynchronous
annotated method.
Is there something similar in Quarkus? I only found the scheduler annotations (which are nice, but I want to start a process only once at the beginning).
So can I just create threads? Or just put my infinite code in void onStart(@Observes StartupEvent ev)
?
Thank you