Elastic-Job

Elastic-Job 是基于 Quartz 和 Zookeeper 的分布式计划作业框架。「Elastic-Job is a distributed scheduled job framework, based on Quartz and Zookeeper.」

Github星跟踪图

Elastic-Job - distributed scheduled job solution

Total Lines
Build Status
Maven Status
Gitter
Coverage Status
GitHub release
License

Homepage

中文主页

Elastic-Job-Lite Console GitHub release

Overview

Elastic-Job is a distributed scheduled job solution. Elastic-Job is composited from 2 independent sub projects: Elastic-Job-Lite and Elastic-Job-Cloud.

Elastic-Job-Lite is a centre-less solution, use lightweight jar to coordinate distributed jobs.

Elastic-Job-Lite and Elastic-Job-Cloud provide unified API. Developers only need code one time, then decide to deploy Lite or Cloud as you want.

Features

  • Distributed schedule job coordinate
  • Elastic scale in and scale out supported
  • Failover
  • Misfired jobs refire
  • Sharding consistently, same sharding item for a job only one running instance
  • Self diagnose and recover when distribute environment unstable
  • Parallel scheduling supported
  • Job lifecycle operation
  • Lavish job types
  • Spring integrated and namespace supported
  • Web console

Architecture

Elastic-Job-Lite

Elastic-Job-Lite Architecture

Release Notes

Roadmap

Quick Start

Add maven dependency

<!-- import elastic-job lite core -->
<dependency>
    <groupId>io.elasticjob</groupId>
    <artifactId>elastic-job-lite-core</artifactId>
    <version>${lasted.release.version}</version>
</dependency>

<!-- import other module if need -->
<dependency>
    <groupId>io.elasticjob</groupId>
    <artifactId>elastic-job-lite-spring</artifactId>
    <version>${lasted.release.version}</version>
</dependency>

Job development

public class MyElasticJob implements SimpleJob {
    
    @Override
    public void execute(ShardingContext context) {
        switch (context.getShardingItem()) {
            case 0: 
                // do something by sharding item 0
                break;
            case 1: 
                // do something by sharding item 1
                break;
            case 2: 
                // do something by sharding item 2
                break;
            // case n: ...
        }
    }
}

Job configuration

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:reg="http://www.dangdang.com/schema/ddframe/reg"
    xmlns:job="http://www.dangdang.com/schema/ddframe/job"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://www.dangdang.com/schema/ddframe/reg
                        http://www.dangdang.com/schema/ddframe/reg/reg.xsd
                        http://www.dangdang.com/schema/ddframe/job
                        http://www.dangdang.com/schema/ddframe/job/job.xsd
                        ">
    <!--configure registry center -->
    <reg:zookeeper id="regCenter" server-lists="yourhost:2181" namespace="dd-job" base-sleep-time-milliseconds="1000" max-sleep-time-milliseconds="3000" max-retries="3" />

    <!--configure job -->
    <job:simple id="myElasticJob" class="xxx.MyElasticJob" registry-center-ref="regCenter" cron="0/10 * * * * ?"   sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" />
</beans>

主要指标

概览
名称与所有者apache/shardingsphere-elasticjob
主编程语言Java
编程语言Java (语言数: 3)
平台
许可证Apache License 2.0
所有者活动
创建于2015-09-11 11:28:52
推送于2025-01-10 07:56:34
最后一次提交2024-12-11 15:29:53
发布数31
最新版本名称3.0.4 (发布于 2023-10-14 21:52:27)
第一版名称1.0.1 (发布于 2015-09-25 16:36:00)
用户参与
星数8.2k
关注者数625
派生数3.3k
提交数2.5k
已启用问题?
问题数1317
打开的问题数117
拉请求数943
打开的拉请求数3
关闭的拉请求数195
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?