百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
J

jobrunr

> 编程语言
开源

在 Java 中执行后台处理的一种极其简单的方法。由持久存储提供支持。可供商业使用,开放且免费。

3.0K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

在 Java 中执行后台处理的一种极其简单的方法。由持久存储提供支持。可供商业使用,开放且免费。

The ultimate library to perform background processing on the JVM.
Dead simple API. Extensible. Reliable.
Distributed and backed by persistent storage.
Open and free for commercial use.
Recommended and loved by ThoughtWorks.


     

 

## Overview ```java BackgroundJob.enqueue(() -> System.out.println("This is all you need for distributed jobs!")); ``` Incredibly easy way to perform **fire-and-forget**, **delayed**, **scheduled** and **recurring jobs** inside **Java applications** using only *Java 8 lambda's*. CPU and I/O intensive, long-running and short-running jobs are supported. Persistent storage is done via either RDBMS (e.g. Postgres, MariaDB/MySQL, Oracle, SQL Server, DB2 and SQLite) or NoSQL (MongoDB). JobRunr provides a unified programming model to handle background tasks in a **reliable way** and runs them on shared hosting, dedicated hosting or in the cloud ([hello Kubernetes](https://www.jobrunr.io/en/blog/2020-05-06-jobrunr-kubrnetes-terraform/)) within a JVM instance. ## Feedback > Thanks for building JobRunr, I like it a lot! Before that I used similar libraries in Ruby and Golang and JobRunr so far is the most pleasant one to use. I especially like the dashboard, it’s awesome! [Alex Denisov](https://www.linkedin.com/in/alex-denisov-a29bab2a/) View more feedback on [jobrunr.io](https://www.jobrunr.io/en/#why-jobrunr). ## Features - Simple: just use Java 8 lambda's to create a background job. - Distributed & cluster-friendly: guarantees execution by single scheduler instance using optimistic locking. - Persistent jobs: using either a RDBMS (four tables and a view) or a NoSQL data store. - Embeddable: built to be embedded in existing applications. - Minimal dependencies: ([ASM](https://asm.ow2.io/), slf4j and either [jackson](https://github.com/FasterXML/jackson) and jackson-datatype-jsr310, [gson](https://github.com/google/gson) or a JSON-B compliant library). ## Usage scenarios Some scenarios where it may be a good fit: - within a REST api return response to client immediately and perform long-running job in the background - mass notifications/newsletters - calculations of wages and the creation of the resulting documents - batch import from xml, csv or json - creation of archives - firing off web hooks - image/video processing - purging temporary files - recurring automated reports - database maintenance - updating elasticsearch/solr after data changes - *…and so on* You can start small and process jobs within your web app or scale horizontally and add as many background job servers as you want to handle a peak of jobs. JobRunr will distribute the load over all the servers for you. JobRunr is also fault-tolerant - is an external web service down? No worries, the job is automatically retried 10-times with a smart back-off policy. JobRunr is a Java alternative to [HangFire](https://github.com/HangfireIO/Hangfire), [Resque](https://github.com/resque/resque), [Sidekiq](http://sidekiq.org), [delayed_job](https://github.com/collectiveidea/delayed_job), [Celery](https://github.com/celery/celery) and is similar to [Quartz](https://github.com/quartz-scheduler/quartz) and [Spring Task Scheduler](https://github.com/spring-guides/gs-scheduling-tasks). Screenshots -----------    
   
    Usage ------ [**Fire-and-forget tasks**](https://www.jobrunr.io/en/documentation/background-methods/enqueueing-jobs/) Dedicated worker pool threads execute queued background jobs as soon as possible, shortening your request's processing time. ```java BackgroundJob.enqueue(() -> System.out.println("Simple!")); ``` [**Delayed tasks**](https://www.jobrunr.io/en/documentation/background-methods/scheduling-jobs/) Scheduled background jobs are executed only after a given amount of time. ```java BackgroundJob.schedule(Instant.now().plusHours(5), () -> System.out.println("Reliable!")); ``` [**Recurring tasks**](https://www.jobrunr.io/en/documentation/background-methods/recurring-jobs/) Recurring jobs have never been simpler; just call the following method to perform any kind of recurring task using the [CRON expressions](http://en.wikipedia.org/wiki/Cron#CRON_expression). ```java BackgroundJob.scheduleRecurrently("my-recurring-job", Cron.daily(), () -> service.doWork()); ``` **Process background tasks inside a web application…** You can process background tasks in any web application and we have thorough support for [Spring](https://spring.io/) - JobRunr is reliable to process your background jobs within a web application. **… or anywhere else** Like a Spring Console Application, wrapped in a docker container, that keeps running forever and polls for new background jobs. See [https://www.jobrunr.io](https://www.jobrunr.io) for more info. Installation ------------ #### Using Maven? JobRunr is available in Maven Central - all you need to do is add the following dependency: ```xml org.jobrunr jobrunr ${jobrunr.version} ``` #### Using Gradle? Just add the dependency to JobRunr: ```groovy implementation 'org.jobrunr:jobrunr:${jobrunr.version}' ``` Configuration ------------ #### Do you like to work Spring based? Add the [*jobrunr-spring-boot-3-starter*](https://search.maven.org/artifact/org.jobrunr/jobrunr-spring-boot-3-starter) to your dependencies and you're almost ready to go! Just set up your `application.properties`: ``` # the job-scheduler is enabled by default # the background-job-server and dashboard are disabled by default jobrunr.job-scheduler.enabled=true jobrunr.background-job-server.enabled=true jobrunr.dashboard.enabled=true ``` #### Or do you prefer a fluent API? Define a `javax.sql.DataSource` and put the following code on startup: ``` … ``` ## Contributing See [CONTRIBUTING](https://github.com/jobrunr/jobrunr/blob/master/CONTRIBUTING.md) for details on submitting patches and the contribution workflow. ### How can I contribute? * Take a look at issues with tag called [`Good first issue`](https://github.com/jobrunr/jobrunr/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) * Join the discussion on [Github discussion](https://github.com/jobrunr/jobrunr/discussions) - we won't be using Gitter anymore. * Answer questions on [issues](https://github.com/jobrunr/jobrunr/issues). * Fix bugs reported on [issues](https://github.com/jobrunr/jobrunr/issues), and send us pull request. ### How to build? * `git clone https://github.com/jobrunr/jobrunr.git` * `cd jobrunr` * `cd core/src/main/resources/org/jobrunr/dashboard/frontend` * `npm i` * `npm run build` * `cd -` * `./gradlew publishToMavenLocal` Then, in your own project you can depend on `org.jobrunr:jobrunr:1.0.0-SNAPSHOT`.

GitHub Issues· 0 开放

在 GitHub 查看全部

暂无开放 Issues,或尚未同步最近议题。

> 标签

Javabackground-jobsjavajava-8java-scheduler

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言