Sometimes you may want to postpone a method invocation; for example, to send an email to newly registered users a day after their registration. To do this, just call the
BackgroundJob.schedule method and pass the desired delay:
JobRunr’s BackgroundJobServer periodically checks all scheduled jobs and enqueues them when it is time to run them, allowing workers to execute them. By default, the check interval is equal to 15 seconds, but you can change it by passing the relevant argument to the
BackgroundJob.schedule methods has overloads and accepts:
All DateTime objects are converted to an
Instant - in case of the
LocalDateTime, the systemDefault zoneId is used to convert it.
These scheduling methods are also off-course available on the