JobRunr-Pro v6.0.0
🥳 We're happy to announce the 6.0.0 release of JobRunr! 🥳
New features in JobRunr
This includes a lot of new functionality and improvements:
- Job Builders: You can now create jobs using the
JobBuilderandRecurringJobBuilderwhich allows you to configure all the aspects of aJobvia this builder instead of the@Jobannotation. This means you can now have one api to create jobs with different settings (including name and amount of retries).
An example on how to use theJobBuilder:
jobScheduler.create(aJob()
.withName("My Enqueued Job")
.withAmountOfRetries(3)
.withDetails(() -> service.doWork()));Off course, you can also schedule jobs:
jobScheduler.create(aJob()
.withName("My Scheduled Job")
.scheduleAt(Instant.parse(scheduleAt))
.withDetails(() -> service.doWork()));And this also works for JobRequests:
jobRequestScheduler.create(aJob()
.withName("Scan " + file.getName() + " for viruses")
.scheduleIn(Duration.ofMinutes(10))
.withJobRequest(new ScanFileForVirusJobRequest(file.getAbsolutePath())));- Job Labels: Support for Job Labels! From now on, you can tag jobs with labels (think of a tenant / customer id / ... ). These labels will be visible in the dashboard. Oh, and in the pro version, you can search for labels in the dashboard!
A label can be added both via the existing@Jobannotation or the newJobBuilder:
@Job(name="My Job", labels={"fast-running-job", "tenant-%0"})
void myFastJob(String tenandId) {
// your business logic
}jobScheduler.create(aJob()
.withName("My Enqueued Job")
.withLabels("fast-running-job", "tenant-" + tenantId)
.withDetails(() -> service.doWork()));- Server name visible in dashboard: from now on, the server name is also visible in the dashboard. Under the tab BackgroundJobServers, you will see the host name of each server. This is also configurable and can be controlled via Spring Boot / Micronaut / Quarkus properties
- Spring Boot 3 AOT support: As of JobRunr 6, we generate new artifacts for spring, one for projects on Spring Boot 3 and one for projects still on Spring Boot 2:
<dependency>
<groupId>org.jobrunr</groupId>
<artifactId>jobrunr-spring-boot-2-starter</artifactId>
<version>${jobrunr.version}</version>
</dependency><dependency>
<groupId>org.jobrunr</groupId>
<artifactId>jobrunr-spring-boot-3-starter</artifactId>
<version>${jobrunr.version}</version>
</dependency>The jobrunr-spring-boot-3-starter will automatically participate in the ahead-of-time processing if you're using a JobRequest.
- MDC Support during success and failure of a job: when a Job fails or succeeds, this was already automatically logged. But, you now also have access to all your MDC variables when the success or failure message is logged. Two extra MDC variables have been added:
jobrunr.jobIdandjobrunr.jobName. - Performance improvements:
- on job enqueue: whenever a Job is created, a notification is sent so the dashboard figures can be updated. As this is quite a heavy database aggregation, sometimes enqueueing jobs could take a little bit longer. This is now done one a different thread making sure that enqueueing jobs goes as fast as possible.
- MicroMeter integration: if you were using JobRunr with a framework like Spring, Micronaut or Quarkus and have MicroMeter on the classpath, it would automatically enable metrics for the enqueued / failed / succeeded jobs on each
BackgroundJobServer. As it uses the same heave database aggregation as above, this is now opt-in (or done on the server that hosts the dashboard as it is needed anyway) only, instead of enabled by default on eachBackgroundJobServer. You can still opt-in manually using properties. - for MongoDB: we did some performance improvements related to slow queries in MongoDB
- Stability improvement As most of you know, JobRunr stops processing after 5 severe exceptions (e.g. when your database goes down, ... ). This also happened when for some reason there was a
ConcurrentJobModificationException. JobRunr is now smarter and after a successful run of the JobZooKeeper, the counter will now also go down. The main purpose for this counter is still to detect database outages (if JobRunr would not stop when a database outage happens, it would flood your logs immediately) and stop processing.
New features in JobRunr Pro
- Dashboard improvements:
- Recurring Jobs: The recurring jobs view has improved ... a lot! You can now search for Recurring Jobs by name, label, nextRun, ... . This comes in handy when you have a lot of recurring jobs.
- Jobs: The jobs views has also seen some love and you can now also search for jobs by id and by recurring job id. This allows you to have an instant overview of all the different job instances for a certain recurring job.
- Other improvements: you will now also see the server tags in the Background Job Server tab
- Queues improvements: a queue name should be an enum and this is now possible! When creating a job for a certain queue, you can now just pass an enum! To setup your queues, you can now also use the following property:
org.jobrunr.queues.from-enum=your.package.QueueNamewhere you pass the fully qualified class name to your enum containing the different queues.
Some great new features to take in JobRunr Pro take your job scheduling to the next level:
- Custom Authentication Provider: You can now plugin your own Authentication Provider allowing to plug in custom authentication
- Real-time enqueueing: JobRunr Pro will by default do real-time enqueueing - e.g. if you schedule a Job each night at 8pm, it will now also be enqueued exactly at 8pm (unless you have more than 1000 jobs to enqueue at that time as otherwise it may have a huge performance impact).
The following features are present in JobRunr Pro Enterprise except for our early adopters and great existing customers 🙏:
- Secured dashboard: The JobRunr dashboard now supports OpenId Connect (only OpenId Connect. OAuth2 and SAML is in the works). The OpenId authentication plugin has been tested with Google, Okta, Keycloak and Spring Authorization Server. And it gets even better: if somebody manually intervenes (delete, requeue, ...) with a job using the dashboard, this is now audited!
- Embedded dashboard in Spring: JobRunr can now be embedded completely inside your existing Spring container (Micronaut & Quarkus are planned for 6.1). This means that you can also add custom authentication & security using Spring Security.
- Unlimited Recurring Jobs: Not only the Recurring Jobs Dashboard has improved a lot, you can now also create an (almost) unlimited amount of Recurring Jobs. JobRunr Pro Enterprise makes a difference between recurring jobs that run every minute or less (these are kept in memory) and recurring jobs that run less frequently than once per minute (which are requested from the database). This allows to have almost an unlimited amount of Recurring Jobs. We have personally tested with up to 15.000 Recurring Jobs that run on a certain timestamp.- Recurring Jobs skipped during downtime: You can now configure JobRunr to also run Recurring Jobs that were missed during downtime (e.g. because of deployments, ... ). If this happened, JobRunr will create a new scheduled job for each skipped run that happened during the downtime.
- Recurring Job instances running parallel: You can now configure JobRunr to also run job instances of a recurring job in parallel. By default, if a
RecurringJobtakes longer than the interval it is running, the run will be skipped as otherwise you may end up with creating more jobs than you can process. As of JobRunr 6 however, you can define how many instances of a Recurring Job can run in parallel.
Bugfixes:
- DST issue: JobRunr had an issue related to saving timestamps to the DB - which we discussed in our blog post. This has now been solved and JobRunr 6 will automatically update all your scheduled jobs on initial start. This means that if you have a lot of scheduled jobs, JobRunr will need some time to update all your scheduled jobs.
- Jobs deleted via Dashboard are not automatically permanently deleted: Jobs that were deleted via the dashboard would not get deleted permanently automatically. This has been solved now.
Breaking changes
- If you are using the
jobrunr-spring-boot-starterartifact, this has now been renamed to eitherjobrunr-spring-boot-2-starterandjobrunr-spring-boot-3-starter. Please choose the correct artifact depending on your Spring Boot version. - This release fixes the DST issue which is relevant for all SQL databases. JobRunr will automatically migrate all existing scheduled jobs to fix this issue which may take long (depending on the amount of scheduled jobs). If you are using the
StorageProviderAPI to search for scheduled jobs, you may get different results after this release (shifted with the timezone you are in). - MicroMeter integration: before JobRunr 6 each
BackgroundJobServerwould automatically report statistics about the amount ofENQUEUED/SUCCEEDED/FAILEDjobs to MicroMeter. As eachBackgroundJobServerwould report the same metrics and these metrics uses quite a have database aggregation, this now has changed to an opt-in setting. - The
DisplayNamefilter has been removed and has now been replaced by theDefaultJobFilter.