Official website: http://shardingsphere.apache.org/elasticjob/
ElasticJob is a distributed scheduling solution consisting of two separate projects, Lite and Cloud.
ElasticJob Lite is a lightweight, decentralized solution that provides distributed task sharding services; ElasticJob Cloud is a Mesos framework which use Mesos + Docker(todo) to manage and isolate resources and processes.
Elasticjob uses a unified job API for each product. Developers only need code one time and can deploy at will.
ElasticJob became an Apache ShardingSphere Sub-project on May 28 2020.
Welcome communicate with community via mail list.
-
Elastic Schedule
- Support job sharding and high availability in distributed system
- Scale out for throughput and efficiency improvement
- Job processing capacity is flexible and scalable with the allocation of resources
-
Resource Assign
- Execute job on suitable time and assigned resources
- Aggregation same job to same job executor
- Append resources to newly assigned jobs dynamically
-
Job Governance
- Failover
- Misfired
- Self diagnose and recover when distribute environment unstable
-
Job Dependency(TODO)
- DAG based job dependency
- DAG based job item dependency
-
Job Open Ecosystem
- Unify job api for extension
- Support rich job type lib, such as dataflow, script, HTTP, file, big data
- Focus business SDK, can work with Spring IOC
-
Admin Console
- Job administration
- Job event trace query
- Registry center management
<!-- import elastic-job lite core -->
<dependency>
<groupId>org.apache.shardingsphere.elasticjob</groupId>
<artifactId>elasticjob-lite-core</artifactId>
<version>${lasted.release.version}</version>
</dependency>
<!-- import other module if need -->
<dependency>
<groupId>org.apache.shardingsphere.elasticjob</groupId>
<artifactId>elasticjob-lite-spring</artifactId>
<version>${lasted.release.version}</version>
</dependency>
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: ...
}
}
}
<?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:elasticjob="http://elasticjob.shardingsphere.apache.org/schema/elasticjob"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://elasticjob.shardingsphere.apache.org/schema/elasticjob
http://elasticjob.shardingsphere.apache.org/schema/elasticjob/elasticjob.xsd
">
<!--configure registry center -->
<elasticjob:zookeeper id="regCenter" server-lists="yourhost:2181" namespace="elastic-job" base-sleep-time-milliseconds="1000" max-sleep-time-milliseconds="3000" max-retries="3" />
<!--configure job snapshot service -->
<elasticjob:snapshot id="jobSnapshot" registry-center-ref="regCenter" dump-port="9999"/>
<!--configure job class -->
<bean id="simpleJob" class="xxx.MyElasticJob" />
<!--configure job -->
<elasticjob:simple id="oneOffElasticJob" job-ref="simpleJob" registry-center-ref="regCenter" cron="0/10 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" />
</beans>