用Spring Scheduler实现Quartz的Cron调度。

问题描述 投票:0回答:1
@Component
public class QuartzConfig implements Job{

    @Autowired
    private JobService jobService;

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {

        System.out.println("Check Status");
        jobService.checkQueueStatus();
    }

在quartz.properties文件中,我已经添加了这个细节。

# thread-pool
org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount=2
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true

# job-store
# Enable this property for RAMJobStore
org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore

我如何才能给出Cron Scheduling的作业和触发器的细节呢? 请帮我提供详细的流程。

spring-boot quartz-scheduler
1个回答
0
投票

网上有很多例子向您展示如何整合Quartz和Spring。你可能想检查我们在GitHub上提供的一个测试Web应用程序。

https:/github.comquartzdeskquartzdesk-test-webappsblobmasterquartzdesk-test-quartz-v2-4-xquartzdesk-test-quartz-v2-4-x-logbacksrcmainwebappWEB-INFspringapplicationContext.xml。

搜索 "quartzScheduler "找到Quartz scheduler bean,然后向下滚动查看jobDetails和触发器属性。

© www.soinside.com 2019 - 2024. All rights reserved.