##Elastic-Job - distributed scheduled job solution License:
Maven Central: Elastic-Job is extracted from dd-job which is a component of ddframe. Elastic-Job just removed monitor and integrated standards parts from dd-job. It based on matured open-source productions like Quartz, Zookeeper and its client Curator.
Other components of ddframe also can open-source independently. Dangdang has already released DubboX, which is core component of dd-soa.
The relationship between Elastic-Job and ddframe is in this picture:
##Contributors
Elastic-Job has deployed to Maven Central Repository, add dependencies in your pom.xml file.
<!-- add elastic-job core module --> <dependency> <groupId>com.dangdang</groupId> <artifactId>elastic-job-core</artifactId> <version>${lasted.release.version}</version> </dependency> <!-- add elastic-job spring module, use namespace --> <dependency> <groupId>com.dangdang</groupId> <artifactId>elastic-job-spring</artifactId> <version>${lasted.release.version}</version> </dependency>
public class MyElasticJob extends AbstractThroughputDataFlowElasticJob<Foo> { @Override protected List<Foo> fetchData(JobExecutionMultipleShardingContext context) { List<Foo> result = // get data from database by sharding items return result; } @Override protected boolean processData(JobExecutionMultipleShardingContext context, Foo data) { // process data return true; } }
<?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="oneOffElasticJob" class="xxx.MyElasticJob" registry-center-ref="regCenter" cron="0/10 * * * * ?" sharding-total-count="3" sharding-item-parameters="0=A,1=B,2=C" /> </beans>