Is there a way to prevent a StartupEvent
from being reprocessed on dev mode application restart ?
#48485
Unanswered
celcius112
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone !
We have a method that observes a
StartupEvent
. This method is only triggered in Quarkus dev mode. This method performs non-idempotent operations, so we want it to run only once, even across application restarts in dev mode.However, every time the application restarts in dev mode (e.g., due to a code change), the
StartupEvent
is fired again, and the method is re-executed. We tried guarding it with astatic boolean
flag, but this does not work — the class is reloaded, and the static state is reset.Is there a Quarkus-native way to prevent this event to be reprocessed, or must we rely on external mechanisms such as a distributed cache or a marker file ?
Beta Was this translation helpful? Give feedback.
All reactions