It’s time for a new release, and boy, what a release it is. In this release I focused on two things: performance and usability.

Do note that this release is NOT backwards compatible if you’re using a relational database: to use it, you will need to delete all JobRunr related tables in your database.


Performance improvements

As I’m still working towards version 1.0, I did some research in the performance of JobRunr. In doing so, I found a better queuing technique to keep threads busier resulting in a 10 to 15% performance increase.

Dashboard improvements

This release also includes some new enhancements for the dashboard (spoiler alert: there is screen recording available further below):

Live updates for each job

When you’re viewing a job, you now have live updates for that job - this means that if you visit the details of an enqueued job, as soon as it will start processing, you will see the job state change to processing. The same of course goes for state changes to succeeded and deleted.

Logging for each job

The feature introduced above, live updates, means we now also can add logging for each job in the dashboard. When you log something, it is automatically also visible inside the dashboard and new messages will appear as they’re logged, it is as if you’re looking at a real console. To log something in the dashboard, you have two options:

  • you can use the JobContext and use it’s logger:
    jobContext.logger().info('this will appear in the dashboard');
  • or - even easier - wrap your existing Logger as follows:
    new JobRunrDashboardLogger(LoggerFactory.getLogger(MyService.class))

The last logger will make sure that all info, warn and error statement will be shown in the dashboard for each job. Debug logging is not supported as I want to prevent to spam the various browsers.

Progress bar for jobs

Long running jobs take time - and sometimes you need to know how long a job will take. Thanks to the new progress bar in JobRunr, you can now track progress from within the dashboard - a progress bar will appear automatically just below the ‘Processing job’ header and advance while work is progressing.

To use this feature, you will need to inject the JobContext into your job: BackgroundJob.enqueue(() -> myService.doWork(JobContext.Null)).

Inside your actual job, you can then use the JobContext to create a progress bar:

public class MyService {

	public void doWork(JobContext jobContext) {
    	JobDashboardProgressBar progressBar = jobContext.progressBar(1000);
        for(int i = 0; i < 1000; i++) {
        	//do actual work
            // or you can also use

A picture says more than a 1000 words

Watch logging appear live from your actual job

Other improvements

  • GitHub issue 8: dashboard not visible if not background job servers available.
  • GitHub issue 9: you will now be redirected immediately to the dashboard
  • GitHub issue 11: the lambda you enqueue can now return a result (though you won’t be able to do anything with it)
  • GitHub issue 13: added option to set the amount of workers via the Fluent API
  • GitHub issue 15: jobs that were processing while a background job server crashed are now being picked up by another server
  • GitHub issue 17: all jobs can now be deleted
  • GitHub issue 19: an exception while adding/removing listeners has been solved