JobRunr
| Company type | Open-source software |
|---|---|
| Industry | Software development |
| Founded | April 2020 |
| Founder | Ronald Dehuysser |
| Headquarters | Belgium |
| Products | Job scheduling library for Java |
| Website | www |
JobRunr is an open-source scheduling library designed for the Java ecosystem, allowing developers to queue, postpone, or execute recurring background tasks across multiple JVM instances. It maintains task state within relational or NoSQL databases.
History
Created by Belgian programmer Ronald Dehuysser and released in April 2020, JobRunr rapidly established itself as a lightweight alternative to Quartz Scheduler and Spring Batch, particularly suited for cloud-native environments. It integrates smoothly with frameworks such as Spring and Quarkus, and includes a built-in dashboard for task monitoring. Dehuysser introduced JobRunr on GitHub during the initial COVID-19 lockdowns, branding it as the "Hangfire for Java." By mid-2021, the library was compatible with early-access versions of JDK 17, highlighting its commitment to future-proofing and involvement in Oracle's Quality Outreach initiative.
The release of version 4.0 in September 2021 marked a significant advancement, featuring a job-analysis performance mode, support for static-method lambdas, optional byte-code caching, and official starters for Spring Boot, Quarkus, and Micronaut. Half a year later, version 5.0 introduced default retry policies, cron enhancements including "last-day" semantics, a Spring Native starter, duration-based recurring scheduling, and optional MDC propagation within dashboard logs.
In February 2023, JobRunr 6.0 improved developer experience by introducing a fluent JobBuilder API, allowing arbitrary job labels, adding an opt-in Micrometer metrics bridge, and optimizing performance to reduce enqueue latency by half under heavy load.
With the May 2024 release of version 7.0, JobRunr embraced JDK 21's virtual threads by automatically switching worker pools when the JVM supports them. This version also replaced random UUIDs with time-based UUIDs to minimize database index fragmentation, relocated the @Recurring annotation into the core module, and added an InMemoryStorageProvider to speed up continuous integration workflows.
Features
JobRunr meets typical background processing requirements such as batching emails, generating PDFs, managing ETL workflows, and handling asynchronous REST callbacks without the need for an external service bus. Jobs are expressed as Java 8 lambdas or method references; during execution, the library uses ASM to analyze byte-code, serializes invocation details into JSON format, and persists them through a configurable StorageProvider supporting RDBMS, MongoDB, Redis, Elasticsearch, or in-memory storage.
Prominent features include:
- Unified API: three straightforward methods (
enqueue,schedule,scheduleRecurrently) complemented by a fluent builder introduced in version 6.0 for defining complex triggers. - Distributed processing: optimistic locking guarantees exactly-once execution even when multiple
BackgroundJobServerinstances poll shared storage. - Dashboard: a self-contained Servlet offering real-time job visualizations, retry management, server health metrics, and MDC variable support for trace propagation since version 5.x.
- Framework support: includes a Spring Boot starter compatible with native images, Quarkus extension, Micronaut bean integration, Jakarta EE CDI wiring capabilities, and a lightweight JUnit 5 testing harness.
- Observability: optional Micrometer timers and counters track succeeded, failed, and enqueued jobs; structured logging; and telemetry at the SQL level.
- Performance enhancements: support for virtual threads (from v7.0 onwards), time-based UUIDs to reduce index fragmentation, cached job analyses, batched SQL operations, and adjustable thread counts per server instance.
Architecture
JobRunr is designed around a storage-focused architecture. During job scheduling, it captures the intended lambda or method along with its parameters and metadata, then serializes this information into JSON format before inserting it into a job table or collection. In clustered setups, optimistic locking guarantees that only one process successfully claims a job. The worker nodes, known as BackgroundJobServers, regularly poll the storage system at configurable intervals—typically every 200 milliseconds for in-memory use and between 5 to 15 seconds in production environments. Once a job is claimed, the server deserializes the data, resolves Spring or Micronaut beans as needed, executes the user-defined code within worker threads (either virtual or platform threads), and atomically updates the job’s status. Jobs that fail are automatically retried up to ten times by default, employing an exponential back-off strategy.
JobRunr’s StorageProvider abstraction enables compatibility with a wide range of storage systems, including traditional relational databases like PostgreSQL, MariaDB, and Oracle, as well as NoSQL databases such as MongoDB. Each storage provider leverages either SQL-based or driver-specific concurrency mechanisms; version 7.0 introduced support for SELECT … FOR UPDATE SKIP LOCKED in PostgreSQL and MySQL to minimize lock contention.
The dashboard interface and REST API endpoints are bundled within the core application, requiring no external services. They operate within the same transactional context as job execution to maintain eventually consistent metrics. Additionally, the commercial "JobRunr Pro" edition extends the open-source foundation by offering features such as priority queues, batch chaining capabilities, and forthcoming carbon-aware scheduling functionality.