r/SpringBoot • • Jul 06 '26

News JobRunr (distributed background job processing for the JVM) is now available on start.spring.io (Spring Initializr)

JobRunr is now available in the Spring Initializr dependency list, so you can add it straight from start.spring.io when you create a new project. No more wiring the starter in by hand afterwards.

For people who don't know us:

JobRunr is an open-source library for background job processing on the JVM: fire-and-forget, scheduled, delayed, durable, and recurring (cron) jobs.

You enqueue work as a lambda and it runs asynchronously, in the same app or across a cluster of workers.

BackgroundJob.enqueue(() -> myService.sendInvoice(invoiceId));

BackgroundJob.schedule(Instant.now().plus(5, DAYS), () -> reminderService.send(userId));

What tends to make people switch to it:

  • No extra infrastructure. Jobs are persisted in your existing SQL or NoSQL database. No Redis, RabbitMQ, or separate broker to run and babysit.
  • Automatic retries with backoff on failure, so transient errors don't lose work.
  • Distributed by default. Run multiple instances and jobs are picked up once across the cluster, no double execution.
  • Built-in dashboard to see enqueued, scheduled, succeeded, and failed jobs, and retry them.
  • Spring Boot autoconfiguration via the starter, plus first-class support for virtual threads (Loom) and Spring Boot 3 & 4

It sits in the same space as Quartz or @Scheduled, but aimed at durable, distributed background work rather than just triggering methods on a timer.

You can even use it for durable jobs. With runStepOnce, each step in a job runs exactly once and is checkpointed, so if the job fails and retries, the steps that already succeeded are skipped instead of re-run:

BackgroundJob.enqueue(() -> processOrder(orderId, JobContext.Null));

public void processOrder(UUID orderId, JobContext context) {
  context.runStepOnce("order-confirmation", () -> orderService.sendConfirmation(orderId));
  context.runStepOnce("warehouse-notification", () -> orderService.notifyWarehouse(orderId));
  context.runStepOnce("shipment-initiation", () -> orderService.initiateShipment(orderId));
}

Thanks to Josh Long and the Spring team for helping get it onto Initializr. We'll be around in the comments to answer anything, including the honest limitations.

93 Upvotes

41 comments sorted by

View all comments

Show parent comment

1

u/Intrepid-Boat-9128 Jul 07 '26

Our scheduling mechanism is centralized in a dedicated Scheduler module. All scheduled jobs are configured in a crontabs.txt file, where each record maps a cron expression to a specific REST API endpoint. The APIs themselves are implemented within their respective microservices, while the Scheduler is responsible only for invoking these endpoints at the configured schedule, keeping the scheduling logic decoupled from the business logic.

Do you think it’s a good practise or we should adopt jobrunr ?

Our schedulers are mostly used for calling third party apis for retrials or generating daily reports.

2

u/JobRunrHQ Jul 07 '26

Whether to move to JobRunr comes down to whether you want what it adds, and for your two use cases (third-party retries + daily reports) it lines up well.

Good news: you wouldn't have to change your architecture to adopt it.

  • Keep the dedicated Scheduler module. Load your crontabs.txt on startup (e.g. @PostConstruct) and register each entry with JobScheduler.scheduleRecurrently(id, cron, ...). Or drop the file and annotate methods directly with @Recurring(id = "...", cron = "...").
  • You don't even need the internal REST hop. With the Spring Boot starter, JobRunr can turn any public method of your services into a job and resolves the bean straight from the Spring IoC container, so the scheduler calls the business method directly instead of going over HTTP to your own endpoints. Docs: https://www.jobrunr.io/en/documentation/background-methods/background-jobs-dependencies/

What you'd actually gain over cron-hits-an-endpoint:

  • Automatic retries with backoff, which is exactly what you want for the flaky third-party calls (today a failed cron tick is just gone unless you built retry yourself).
  • Persistence, so a run that should've fired while the app was down isn't silently missed.
  • A dashboard to see which report runs and third-party calls succeeded or failed, with one-click requeue.
  • Distributed coordination, so a recurring job runs once across the cluster instead of firing on every instance.

So: keep what you have if it's serving you well, but if you're hand-rolling the retry handling and visibility today, JobRunr takes that off your plate without forcing an architecture change.

2

u/Intrepid-Boat-9128 Jul 07 '26

Got to know a diff approach ! Thanks ! I will definitely try to accommodate these and do a POC. Might come up later if any queries arise !