• 定时任务(二)


    package com.sf.dangbao.core.TimeTask;

    import org.quartz.*;
    import org.springframework.beans.factory.annotation.Value;
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.Configuration;


    /**
    * @author pxz
    * @date 2019/4/28
    * @description :
    */
    @Configuration
    public class QuartzJobConfig {

    @Value("${send.corn}")
    private String sendTaskJobCorn;

    @Value("${send.tomorrow}")
    private String tomorrowJobCorn;

    @Bean
    public JobDetail distributeTaskJob() {
    return JobBuilder.newJob(DistributeTaskJob.class).withIdentity("distributeTaskJob").storeDurably().build();
    }

    @Bean
    public JobDetail tomorrowTaskJob(){
    return JobBuilder.newJob(TomorrowTaskJob.class).withIdentity("tomorrowTaskJob").storeDurably().build();
    }

    @Bean
    public Trigger storeCheckJobTrigger() {
    CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(sendTaskJobCorn);
    return TriggerBuilder.newTrigger().forJob(distributeTaskJob()).withIdentity("storeCheckJobTrigger")
    .withSchedule(scheduleBuilder).build();
    }

    @Bean
    public Trigger tomorrowJobTrigger() {
    CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(tomorrowJobCorn);
    return TriggerBuilder.newTrigger().forJob(tomorrowTaskJob()).withIdentity("tomorrowJobTrigger")
    .withSchedule(scheduleBuilder).build();
    }
    }
  • 相关阅读:
    Hadoop、spark
    Hadoop、spark
    Hadoop、spark
    Hadoop、spark
    SQL查询表中的用那些索引
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    【转】迷你区块链(mini blockchain in python)
    理解 Web 3
    【转】数字货币钱包:生态及技术
    【转】用 Witnet 协议使加密网络可以跨链访问
  • 原文地址:https://www.cnblogs.com/pxzbky/p/11911322.html
Copyright © 2020-2023  润新知