Search in sources :

Example 1 with JavaSimpleListener

use of com.dangdang.ddframe.job.example.listener.JavaSimpleListener 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)

Aggregations

JobCoreConfiguration (com.dangdang.ddframe.job.config.JobCoreConfiguration)1 SimpleJobConfiguration (com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration)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 JobScheduler (com.dangdang.ddframe.job.lite.api.JobScheduler)1