在Azure存储Quartz.NET作业时,“现有工作”的错误 [英] 'Existing Job' error when storing Quartz.NET job on Azure

查看:268
本文介绍了在Azure存储Quartz.NET作业时,“现有工作”的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何创建出来扔以下错误adojobstore:

How do I create adojobstore with out throwing the following error:

 Unable to store job because one already exists with this identification.

我可以从数据库中读取并检查作业不存在,然后将其添加到调度?
是这样做的推荐的方法?

Can I read from the database and check if the job does not exist then add it to the scheduler? Is that the recommended way of doing?

是否有必要关闭在Azure上调度?

Is it necessary to Shutdown the scheduler on Azure?

推荐答案

当你正在使用AdoJobStore,您在DB节省作业,以便确定可以单独调度作业,否则只是使用AddJob前检查表作业的存在用相同的作业ID,并确保建立一个持久的工作。

As you are using AdoJobStore, you are saving jobs in DB so you sure can check the existence of a job in table separately before scheduling a job otherwise just use AddJob with the same JobID and be sure to create a durable job.

,可重复使用,必须是持久的作业,是指作业仍然存在即使未排定它,这意味着没有连接到它的触发。耐用作业的一个例子是如下:

The job which can be reused must be durable, means jobs still exist even when it is not scheduled, which means there is no trigger attached to it. An example of durable job is as below:

dJob = new JobDetail("consolidate-attendance", "daily-attendance-group", 
              ConsolidateAttendance.class,
              /* volatile */ false, 
              /* durable */ true,
              /* recover */ false);
sched.addJob(jobContext, dJob, false);

ScheduleJob有两个版本,所以你需要确保你使用的一一接受触发和另一个作业工作。如果您已经定义了工作,那么你不能使用ScheduleJob这同时接受一份工作和触发器,因为在内部调度会尝试将作业添加到自己和失败。

ScheduleJob has two version, one accept job with trigger and another job so you need to be sure which one you will use. If you have already define the job then you cannot use ScheduleJob which accepts both a job and a trigger because internally the scheduler would try to add the job to itself and fail.

当作业已经被定义,你只需要通过通过触发类绑定触发的工作和使用只接受触发scheduleJob。

When job is already defined, you just need to bind job with trigger through via Trigger class and use the scheduleJob that only accepts a trigger.

这应该工作,你不需要关机调度。

This should work and you don't need to shutdown the scheduler.

这篇关于在Azure存储Quartz.NET作业时,“现有工作”的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆