Quarkus includes an extension called scheduler, which can be used to schedule tasks for single or repeated execution. We can use the cron format to specify the number of times the scheduler fires the event.
The source code for the following example is located in the Chapter08/scheduler folder of this book's GitHub repository. If you check the pom.xml file, you will notice that the following extension has been added to it:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-scheduler</artifactId>
</dependency>
Our sample project generates a random token (for the sake of simplicity, a random string is used) every 30 seconds. The class that's in charge of generating random tokens is the following TokenGenerator class:
@ApplicationScoped
public class TokenGenerator {
private...