Schedule your events by JobRunr – firt touch

Today, I would like to show you how to easily schedule your events in your backend using the JobRunr framework.

I’ve been searching for a framework that allows scheduling jobs and monitoring their statuses, and JobRunr stands out for offering a GUI to track job statuses. This feature is a significant benefit from my perspective.

In my use case, I consume data from a queue and need to schedule services to start mining data on specific dates. JobRunr supports a fluent API and integrates with Spring Starter, Micronaut, and Quarkus.

I use Spring Web and its integration with JobRunr. The dependency setup looks like this:


You will need a database because JobRunr persists all of its jobs and schedules into a database. For testing purposes, I used H2.

Here’s an example of the application.yaml where you can see how to set up the GUI and job schedulers:

      enabled: true
      enabled: true
  • job-scheduler.enabled: true: This line enables the job scheduling feature of JobRunr, allowing you to schedule jobs to run at specific times or intervals.
  • background-job-server.enabled: true: This line enables the background job server feature of JobRunr, allowing the application to process and run the scheduled or enqueued jobs.

Or you can use initJobRunr bean:

    fun initJobRunr(dataSource: DataSource, jobActivator: JobActivator): JobRunrConfigurationResult {
        return JobRunr.configure()

    fun initJobScheduler(jobRunrConfigurationResult: JobRunrConfigurationResult): JobScheduler {
        return jobRunrConfigurationResult.jobScheduler

    fun initJobRequestScheduler(jobRunrConfigurationResult: JobRunrConfigurationResult): JobRequestScheduler {
        return jobRunrConfigurationResult.jobRequestScheduler
  • JobRunr.configure(): Starts JobRunr configuration.
  • useJobActivator(jobActivator): Sets the job activator for creating job instances.
  • useStorageProvider(SqlStorageProviderFactory.using(dataSource)): Configures SQL storage provider with the specified data source.
  • useBackgroundJobServer(): Configures and enables the background job server.
  • useDashboard(8801): Sets up a web dashboard on port 8801 for job monitoring and management.
  • initialize(): Finalizes and activates the configuration, starting the job server and dashboard.

This configuration sets up the JobScheduler and JobRequestScheduler beans, enabling you to schedule and manage your jobs effectively.

After start up your application you can see init db scripts for jobrunr:


Dashboard is available on you specific port:

JobRunr Dashboard using H2StorageProvider started at http://localhost:8801/dashboard

There is first look how UI looks like

Now we need prepare our service which we want to use as a job

After that we need to create job scheduler service which will be resposible for creating jobs at the first time we want to create a single job fire and forgot, it does not matter if will be success or not just send for this purpose we will use enqueueing jobs

And because I need to run this job scheduler, for demo purposes i create application runner where after start up a call jobScheduler service and run a specific method for job creation.

Example of notification service which will send notification for demo purposes we just

There you can si how our first job run successfully

Whole implementation you can find in our github repo

In the next lecture we will focus on another jobs which you can use with JobRunr

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *