![JAR search and dependency download from the Maven repository](/logo.png)
com.github.ltsopensource.example.springboot.JobClientReferenceBean Maven / Gradle / Ivy
The newest version!
package com.github.ltsopensource.example.springboot;
import com.github.ltsopensource.core.domain.Job;
import com.github.ltsopensource.jobclient.JobClient;
import com.github.ltsopensource.jobclient.domain.Response;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @author Robert HG ([email protected]) on 4/9/16.
*/
@Component
public class JobClientReferenceBean implements InitializingBean {
@Autowired
private JobClient jobClient;
@Override
public void afterPropertiesSet() throws Exception {
Job job = new Job();
job.setTaskId("t_555");
job.setParam("shopId", "1122222221");
job.setTaskTrackerNodeGroup("test_trade_TaskTracker");
job.setNeedFeedback(true);
job.setReplaceOnExist(true); // 当任务队列中存在这个任务的时候,是否替换更新
job.setCronExpression("0 0/1 * * * ?");
// job.setTriggerTime(DateUtils.addDay(new Date(), 1));
Response response = jobClient.submitJob(job);
System.out.println(response);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy