JobRunr v8.0.0-beta.1
Exciting times! We're pleased to announce the first beta of JobRunr v8. If you have any feedback on the changes listed below, please let us know by opening a discussion: https://github.com/jobrunr/jobrunr/discussions. Thanks for taking the time to try out the v8 beta!
Highlighted Features
Ahead of time scheduled recurring jobs
In v7 and lower, JobRunr schedules recurring jobs very close to the moment they need to run (typically a poll interval earlier). In v8, JobRunr schedules the recurring job as soon as the previous run is finished.
Kotlin Serialisation support
JobRunr v8 introduces a new JsonMapper, KotlinxSerializationJsonMapper to improve the Kotlin developer’s experience when using JobRunr.
Usage
Add the below to build.gradle:
plugins {
kotlin("plugin.serialization") version "2.1.20"
}
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
implementation("org.jobrunr:jobrunr-kotlin-2.1-support:8.0.0-beta.1")
}
You’ll need to programmatically configure the KotlinxSerializationJsonMapper either using JobRunr fluent API (see below) or by replacing the default JsonMapper bean provided by JobRunr’s autoconfiguration.
@OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class)
fun main() {
val scheduler = JobRunr.configure()
.useJsonMapper(KotlinxSerializationJsonMapper())
// ...
.jobScheduler!!
}
Note: we have not tested versions lower than 1.8.0 of kotlinx-serialization-json. Additionally, KotlinxSerializationJsonMapper may not be able to deserialize items serialized by another JsonMapper.
Thanks to @SIMULATAN for contributing this feature!
@AsyncJob to reduce boilerplate
A call to a method, annotated with @Job from a class annotated with @AsyncJob, will be intercepted by JobRunr. Instead of the method being executed, an enqueued Job will be created and saved for later execution. This works similarly to Spring’s @Async, which executes the method asynchronously.
Limitation: currently only available for Spring applications.
Usage
@Test
public void testAsyncJob() {
asyncJobTestService.testMethodAsAsyncJob();
await().atMost(30, TimeUnit.SECONDS).until(() -> storageProvider.countJobs(StateName.SUCCEEDED) == 1);
}
@AsyncJob
public static class AsyncJobTestService {
@Job(name = "my async spring job")
public void testMethodAsAsyncJob() {
LOGGER.info("Running AsyncJobService.testMethodAsAsyncJob in a job");
}
}
Thanks to @devashishTaneja for contributing this feature!
Improved @Recurring synchronisation
This feature aims to reduce manual intervention by automatically deleting a RecurringJob when JobRunr cannot find the associated method or when the method is no longer annotated with @Recurring.
Label ordering
Labels are kept in the order they are initially introduced.
End of support for Redis and Elasticsearch
Redis and Elasticsearch StorageProviders were deprected in v7 and are removed from JobRunr in v8.
What's Changed
- Make labels display order consistent by @auloin in #1079
- Make event source work in dev mode by @auloin in #1154
- Auto delete RecurringJob's via annotation. by @rdehuyss in #1185
- [Feature] Automatically create jobs if Spring Bean is annotated with @AsyncJob Annotation by @devashishTaneja in #1181
- Make InMemoryStorageProvider implementation more consistent by @rdehuyss in #1196
- Move to Oracle Free by @rdehuyss in #1205
- [Frontend] Fix listener cleanup by @auloin in #1220
- Support kotlinx.serialization by @SIMULATAN in #1207
- MongoDB Usage Index improvement by @rdehuyss in #1226
- Improve Progress bar by @rdehuyss in #1228
- Drop support for Redis and ElasticSearch in v8 by @rdehuyss in #1230
- Fix progress bar by @rdehuyss in #1231
- Merge master in v8 by @rdehuyss in #1227
- Add and test existing 404s for the Webserver API by @wgroeneveld in #1233
- Merge master to v8 by @rdehuyss in #1236
- Schedule recurring jobs ahead of time by @rdehuyss in #1225
- Micrometer reporting improvements by @rdehuyss in #1251
- Align sql statement construct with JobRunr Pro by @rdehuyss in #1252
- Merge master into v8 by @auloin in #1254
- Reduce the amount of methods exposed by JobScheduler and JobRequestScheduler by @auloin in #1255
- Align Kotlinx Support with JobRunr Pro by @auloin in #1248
- Add support for SLF4J Marker in JobRunr Dashboard. by @rdehuyss in #1256
- Drop
orgprefix from JobRunr's Spring properties by @auloin in #1258 - Improve UUIDv7 test by @rdehuyss in #1259
- Improvements to align with Pro by @rdehuyss in #1260
- Stop logging when job is already scheduled ahead of time by @auloin in #1267
- Try to Fix concurrent builds on Mac by @rdehuyss in #1266
- Improve logging on Drone CI by @rdehuyss in #1271
- Add support for gradle build cache by @rdehuyss in #1273
- [Dashboard] Add confirmation dialog for deleting recurring job by @auloin in #1268
Breaking Changes
AbstractJob#setLabels,JobBuilder#withLabelsandRecurringJobBuilder#withLabelsnow expect aListinstead of aSetas an argument.- Micrometer: job stats metrics have changed name. Before:
jobrunr.jobs.[statename](where statename takes the value varies. After:jobrunr.jobs.by-state. ScheduledState: removal of constructorScheduledState(Instant scheduledAt, RecurringJob recurringJob)useScheduledState.fromRecurringJob(Instant scheduledAt, RecurringJob recurringJob)instead.- Remove
orgfrom JobRunr’s Spring properties - End of support for Redis and Elasticsearch StorageProviders
JobDashboardProgressBar: methodincreaseByOnerenamed toincrementSucceededStorageProvider:getRecurringJobsLatestScheduledRunhas been removed, usegetRecurringJobScheduledInstantsinstead.
New Contributors
- @devashishTaneja made their first contribution in #1181
Full Changelog: v7.5.1...v8.0.0-beta.1