December 2019
Intermediate to advanced
314 pages
6h 51m
English
If you need to execute one-time events, then you can inject the io.quarkus.scheduler.Scheduler class into your code directly and use the startTimer method, which will fire the execution of an action in a separate thread. This can be seen in the following example:
@InjectScheduler scheduler;public void oneTimeEvnt() { scheduler.startTimer(300, () -> oneTimeAction()); }public void oneTimeAction() { // Do something}
In this brief excerpt, we can see how a single event, which will be executed in the oneTimeAction() method, can fire a one-time action after 300 milliseconds.
Read now
Unlock full access