Scheduler.x Quickstart
Scheduler.x
provides a builder pattern that allows you to create custom schedules for different business applications.
You can design a loop of recurrence from simple to complex in the Trigger
object, step by step. After that, you can build a corresponding Scheduler
object to manage the scheduling lifecycle, which contains a Job
that performs your business operations.
IntervalTrigger trigger = IntervalTrigger.builder().interval(Duration.ofSeconds(5)).build(); (1)
Job<Void, Void> job = (jobData, executionContext) -> System.out.println("Get started with scheduler.x");(2)
IntervalScheduler scheduler = IntervalScheduler.<Void, Void>builder() (3)
.setVertx(vertx).setTrigger(trigger).setJob(job).build();
// After starting, every 5 seconds, the program will print to
// the console log with the text `Get started with scheduler.x`
scheduler.start(); (4)
// Do other stuff
System.out.println("Are you ready to explore more?");}
1 | Create an Interval trigger |
2 | Create simple job |
3 | Create an Interval Scheduler |
4 | Start a scheduler |