Software:JobRunr

From HandWiki
JobRunr
Original author(s)Ronald Dehuysser
Developer(s)JobRunr BV
Initial releaseApril 8, 2020; 6 years ago (2020-04-08)
Stable release
8.6.1 / May 26, 2026; 29 days ago (2026-05-26)
Repositorygithub.com/jobrunr/jobrunr
Written inJava
Operating systemCross-platform
PlatformJava
TypeLibrary
LicenseLGPL-3.0-only
Websitejobrunr.io

JobRunr is an open-source job-scheduling library for the Java platform that lets developers enqueue, delay or run recurring background tasks across one or many JVMs while persisting state in a relational or NoSQL data store.

History

First released in April 2020 by Belgian developer Ronald Dehuysser, the project has become a popular alternative to Quartz Scheduler and Spring Batch for cloud-native workloads owing to its lightweight API, seamless integration with other frameworks (such as Spring or Quarkus) and embedded dashboard.[1] Dehuysser unveiled the initial public version of JobRunr on GitHub during the early COVID-19 lockdowns, positioning it as "Hangfire for Java." The library compiled cleanly on the JDK 17 early-access builds by July 2021, signalling an emphasis on forward compatibility and participation in Oracle's Quality Outreach programme.[2]

Version 4.0 (September 2021) marked the first major milestone. InfoQ reported that the release added a job-analysis performance mode, static-method lambda support and optional byte-code caching, together with first-class starters for Spring Boot, Quarkus and Micronaut.[3]

Six months later, JobRunr 5.0 shipped with default-retry configuration, cron extensions supporting "last-day" semantics and an officially supported Spring Native starter. The update also introduced Duration-based recurrent scheduling and optional MDC propagation in the dashboard logs.[4]

JobRunr 6.0 (February 2023) focused on developer ergonomics: a fluent JobBuilder API, arbitrary job labels, an opt-in Micrometer metrics bridge and performance tweaks that halved enqueue latency under load test.[1]

With JobRunr 7.0 (May 2024) the project embraced JDK 21's virtual threads, automatically switching the worker pool when the host JVM supports it, and replaced random UUIDs with time-based UUIDs to reduce database-index fragmentation. The release also moved the @Recurring annotation into the core module and introduced an InMemoryStorageProvider for rapid CI pipelines.[5]

Version 8.0 (July 2025) introduced carbon-aware job scheduling, which uses CO₂ intensity forecasts from the European electricity grid to shift discretionary workloads into periods of cleaner energy. JVM Weekly described the feature as part of a broader movement in the JVM ecosystem toward sustainable computing.[6] The release also added Kotlin serialization support, a redesigned dashboard notification centre, Kubernetes autoscaling metrics with KEDA integration, and a multi-cluster dashboard for monitoring several JobRunr installations from a single console.[6]

Version 8.5 (March 2026) simplified Kotlin support and reduced startup times, while the Pro edition gained external job support and dashboard audit logs. Version 8.6 (May 2026) delivered full JDK 26 compatibility, official support for Quarkus 3.33 LTS, and performance improvements for recurring jobs.[7]

Features

JobRunr targets common background-processing tasks, sending email batches, PDF generation, ETL pipelines or asynchronous REST callbacks, without requiring a separate service bus. Jobs are expressed as ordinary Java 8 lambdas or method references; at run time the library inspects the byte-code with ASM, serialises the invocation metadata to JSON and stores it via a pluggable StorageProvider (RDBMS, MongoDB, Redis, Elasticsearch or in-memory).[8]

Key functional highlights include:

  • Unified API: three one-liners (enqueue, schedule, scheduleRecurrently) and a more expressive fluent builder added in v 6.0 for complex triggers.[1]
  • Distributed execution: optimistic locking ensures exactly-once semantics even when multiple BackgroundJobServer instances poll the same table or collection.[1]
  • Dashboard: a self-contained Servlet that surfaces live job graphs, retries and server-health metrics and, since v 5.x, MDC variables for trace propagation.[4]
  • Framework integrations: Spring Boot starter (native-image aware), Quarkus extension, Micronaut bean, Jakarta EE CDI wiring and a thin JUnit 5 test harness.[4]
  • Observability: optional Micrometer timers and counters for succeeded, failed and enqueued jobs; structured logs; and SQL-level telemetry.[1]
  • Performance options: virtual threads (v 7.0 +), time-based UUIDs, cached job analyses, batched SQL and configurable thread counts per server.[5]

Carbon-aware scheduling

Introduced in version 8.0, carbon-aware scheduling lets developers specify a time window rather than a fixed execution time for recurring jobs. JobRunr then queries CO₂ intensity forecasts, and shifts job execution into the period with the lowest expected emissions. Jobs awaiting an optimal window appear in the dashboard with a green leaf indicator, and operators can inspect which region's forecast data informed the decision. The feature is activated by adding a margin expression such as [PT1H/PT3H] to a cron definition, or by using the CarbonAware.dailyBetween helper method.[6]

Architecture

Internally, JobRunr follows a storage-centric architecture. During scheduling the library captures the target lambda or method, its arguments and metadata; serialises this envelope as JSON and inserts it into a job table (or equivalent collection); commits using optimistic locking so that exactly one caller wins in a cluster.[1] Worker nodes, BackgroundJobServers, poll the storage at a configurable interval (200 ms in fast in-memory mode; 5–15 s in production). When a server claims a job it deserialises the payload, resolves any Spring or Micronaut beans, executes user code in a worker thread, virtual or platform, and then updates the job state atomically. Failed executions are automatically re-queued with exponential back-off up to a default of ten retries (tunable or overridable per job).[4]

Because the storage layer is abstracted behind StorageProvider, JobRunr can run on traditional RDBMS systems such as PostgreSQL, MariaDB and Oracle and on NoSQL engines like MongoDB. Each provider supplies SQL or driver-specific concurrency primitives; for example, v 7.0 introduced SELECT … FOR UPDATE SKIP LOCKED for PostgreSQL and MySQL to minimise lock contention.[5]

The dashboard and REST endpoints are packaged so that they do not require a separate service; they share the same transaction scope as job execution, guaranteeing eventually consistent metrics. A commercial "JobRunr Pro" edition layers priority queues, batch chaining and forthcoming carbon-aware scheduling on top of the open-source core.[9]

AI integration

In April 2026, JobRunr co-founder Ronald Dehuysser and Java Champion Markus Eisele published an article arguing that most AI agent frameworks overlook scheduling, retries, and persistence, problems that Java background-job libraries had already solved. Dehuysser wrote that while most agents were effectively stateless chatbots, a real agent "does things when nobody is watching" and needs a proper job scheduling model underneath.[10]

To demonstrate the point, the JobRunr team built ClawRunr (originally called JavaClaw), an open source AI agent runtime written in Java. The project's README described it as "originally created as a demo to show the use of JobRunr." Dehuysser later noted the team expected "a handful of people to try it."[10] Instead the project gained over 200 GitHub stars in its first three days, along with community pull requests and a GraalVM native-image port contributed by Oracle's GraalVM team within the first week.[10]

InfoQ reported that ClawRunr delegates all asynchronous work, including task scheduling, automatic retries with exponential backoff, and dashboard based monitoring, to the JobRunr library. The agent is built on Java 25, Spring Boot, Spring AI, and Spring Modulith, and supports OpenAI, Anthropic, and Ollama as large language model providers. It integrates external tools through the Model Context Protocol (MCP) and communicates through a built in web interface, Telegram, and Discord.[11]

Beyond the ClawRunr project, JobRunr has been used in AI workloads for retrieval augmented generation (RAG), where recurring jobs scan knowledge bases and enqueue parallel embedding updates with automatic retries when language model APIs fail; and for offloading embedding computation from synchronous API request paths to background workers. In May 2025 Oracle published a technical demonstration on its official YouTube channel showing AI vector search combining Spring, JobRunr, and Oracle Database.[12]

References

  1. 1.0 1.1 1.2 1.3 1.4 1.5 Messetti, Andrea (6 February 2023). "JobRunr, the Java Scheduler Library, Releases Version 6.0". https://www.infoq.com/news/2023/02/jobrunr-scheduler-java/. 
  2. Redlich, Michael (2 August 2021). "Le Point Sur l'Actualité de Java – Semaine du 19 Juillet 2021" (in fr). https://www.infoq.com/fr/news/2021/08/java-news-roundup-jul19-2021/. 
  3. Messetti, Andrea (30 September 2021). "JobRunr 4.0 Delivers Improved Integration with Spring Starter, Quarkus and Micronaut". https://www.infoq.com/news/2021/09/jobrunr-4-released/. 
  4. 4.0 4.1 4.2 4.3 Janssen, Johan (27 April 2022). "JobRunr 5.0.0 Delivers Improved Framework Support". https://www.infoq.com/news/2022/04/jobrunr-5-0-0/. 
  5. 5.0 5.1 5.2 Syed, Shaaf (7 May 2024). "JobRunr Introduces Version 7.0 with Built-in Support for Virtual Threads". https://www.infoq.com/news/2024/05/jobrunr-7-virtual-threads/. 
  6. 6.0 6.1 6.2 Skowronski, Artur (17 July 2025). "JobRunr brings Carbon Aware Scheduling to JVM: Saving the planet one job at a time". https://www.jvm-weekly.com/p/jobrunr-brings-carbon-aware-scheduling. 
  7. "JobRunr Releases". https://github.com/jobrunr/jobrunr/releases. 
  8. Zeichick, Alan (2 March 2022). "JobRunr 4.0.0: Static Methods, Caching, and Performance Analysis" (PDF). Oracle. https://blogs.oracle.com/content/published/api/v1.1/assets/CONTF51EEA33B4914B5AA875E0CEAAD4A88B/native/JobRunr%2B4.0.0_%2BStatic%2Bmethods%2C%2Bcaching%2C%2Band%2Bperformance%2Banalysis.pdf. 
  9. Sheth, Maitri (14 May 2024). "JobRunr + Spring Boot". https://dzone.com/articles/jobrunr-spring-boot-1. 
  10. 10.0 10.1 10.2 Eisele, Markus; Dehuysser, Ronald (17 April 2026). "Chatbots Talk. Real AI Agents Schedule Work.". https://www.the-main-thread.com/p/ai-agents-background-jobs-java-jobrunr-clawrunr. 
  11. Carleto, Diogo (1 May 2026). "JobRunr Introduces ClawRunr, an Open-Source Java AI Agent". https://www.infoq.com/news/2026/05/clawrunr/. 
  12. "Perform effective AI Vector search combining Spring, Jobrunr, and Oracle Database". May 2025. https://www.youtube.com/watch?v=IbXJVJ_e6Gk.