Search in sources :

Example 1 with JobScheduler

use of com.dangdang.ddframe.job.lite.api.JobScheduler in project elastic-job by dangdangdotcom.

the class JavaMain method setUpDataflowJob.

private static void setUpDataflowJob(final CoordinatorRegistryCenter regCenter, final JobEventConfiguration jobEventConfig) {
    JobCoreConfiguration coreConfig = JobCoreConfiguration.newBuilder("javaDataflowElasticJob", "0/5 * * * * ?", 3).shardingItemParameters("0=Beijing,1=Shanghai,2=Guangzhou").build();
    DataflowJobConfiguration dataflowJobConfig = new DataflowJobConfiguration(coreConfig, JavaDataflowJob.class.getCanonicalName(), true);
    new JobScheduler(regCenter, LiteJobConfiguration.newBuilder(dataflowJobConfig).build(), jobEventConfig).init();
}
Also used : JobScheduler(com.dangdang.ddframe.job.lite.api.JobScheduler) JobCoreConfiguration(com.dangdang.ddframe.job.config.JobCoreConfiguration) DataflowJobConfiguration(com.dangdang.ddframe.job.config.dataflow.DataflowJobConfiguration) JavaDataflowJob(com.dangdang.ddframe.job.example.job.dataflow.JavaDataflowJob)

Example 2 with JobScheduler

use of com.dangdang.ddframe.job.lite.api.JobScheduler in project elastic-job by dangdangdotcom.

the class JavaMain method setUpSimpleJob.

private static void setUpSimpleJob(final CoordinatorRegistryCenter regCenter, final JobEventConfiguration jobEventConfig) {
    JobCoreConfiguration coreConfig = JobCoreConfiguration.newBuilder("javaSimpleJob", "0/5 * * * * ?", 3).shardingItemParameters("0=Beijing,1=Shanghai,2=Guangzhou").build();
    SimpleJobConfiguration simpleJobConfig = new SimpleJobConfiguration(coreConfig, JavaSimpleJob.class.getCanonicalName());
    new JobScheduler(regCenter, LiteJobConfiguration.newBuilder(simpleJobConfig).build(), jobEventConfig, new JavaSimpleListener(), new JavaSimpleDistributeListener(1000L, 2000L)).init();
}
Also used : JobScheduler(com.dangdang.ddframe.job.lite.api.JobScheduler) JobCoreConfiguration(com.dangdang.ddframe.job.config.JobCoreConfiguration) SimpleJobConfiguration(com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration) JavaSimpleJob(com.dangdang.ddframe.job.example.job.simple.JavaSimpleJob) JavaSimpleListener(com.dangdang.ddframe.job.example.listener.JavaSimpleListener) JavaSimpleDistributeListener(com.dangdang.ddframe.job.example.listener.JavaSimpleDistributeListener)

Example 3 with JobScheduler

use of com.dangdang.ddframe.job.lite.api.JobScheduler in project elastic-job by dangdangdotcom.

the class JavaMain method setUpScriptJob.

private static void setUpScriptJob(final CoordinatorRegistryCenter regCenter, final JobEventConfiguration jobEventConfig) throws IOException {
    JobCoreConfiguration coreConfig = JobCoreConfiguration.newBuilder("scriptElasticJob", "0/5 * * * * ?", 3).build();
    ScriptJobConfiguration scriptJobConfig = new ScriptJobConfiguration(coreConfig, buildScriptCommandLine());
    new JobScheduler(regCenter, LiteJobConfiguration.newBuilder(scriptJobConfig).build(), jobEventConfig).init();
}
Also used : JobScheduler(com.dangdang.ddframe.job.lite.api.JobScheduler) JobCoreConfiguration(com.dangdang.ddframe.job.config.JobCoreConfiguration) ScriptJobConfiguration(com.dangdang.ddframe.job.config.script.ScriptJobConfiguration)

Aggregations

JobCoreConfiguration (com.dangdang.ddframe.job.config.JobCoreConfiguration)3 JobScheduler (com.dangdang.ddframe.job.lite.api.JobScheduler)3 DataflowJobConfiguration (com.dangdang.ddframe.job.config.dataflow.DataflowJobConfiguration)1 ScriptJobConfiguration (com.dangdang.ddframe.job.config.script.ScriptJobConfiguration)1 SimpleJobConfiguration (com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration)1 JavaDataflowJob (com.dangdang.ddframe.job.example.job.dataflow.JavaDataflowJob)1 JavaSimpleJob (com.dangdang.ddframe.job.example.job.simple.JavaSimpleJob)1 JavaSimpleDistributeListener (com.dangdang.ddframe.job.example.listener.JavaSimpleDistributeListener)1 JavaSimpleListener (com.dangdang.ddframe.job.example.listener.JavaSimpleListener)1