ElasticJob使用案例

1.pom.xml



   com.dangdang
   elastic-job-core
   1.0.6
   
      
         c3p0
         c3p0
      
   



   com.dangdang
   elastic-job-spring
   1.0.6


2.springbeans-task.xml


<reg:zookeeper id="taskRegCenter" serverLists="${task.zk.url}" namespace="${app_name}-job" baseSleepTimeMilliseconds="1000" maxSleepTimeMilliseconds="3000" maxRetries="3" />


<job:bean id="XXXJob"
          class="com.*"
          regCenter="taskRegCenter" cron="0 0/1 * * * ?" shardingTotalCount="1"
          overwrite="true" misfire="false" />


3.方法

@Component
public class XXXJob extends AbstractSimpleElasticJob {

你可能感兴趣的:(Java常用代码)