自定义 Quartz.Net 触发器 [英] Custom Quartz.Net trigger

查看:97
本文介绍了自定义 Quartz.Net 触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现我自己的自定义触发器.触发器的主要目的两次:开始日期和结束日期(将其视为开/关开关,开"状态和开始日期以及结束日期的关闭"状态).

I would like to implement my own custom trigger. the main purpose of the trigger twice: on start date and end date (think of it as on/off switch, "on" state and start date and "off" state on end date).

实现这一目标的最佳方法是什么?

What is best way to achieve that?

AbstractTrigger 或实施 ITrigger?

是否需要实施 IScheduleBuilder?

推荐答案

当您开始怀疑是否要实现自己的触发器时,可能会出现错误的方向.Quartz 有一组丰富的触发器,可以满足基于间隔/重复规则的各种调度需求.

When you start to wonder whether to implement your own trigger there's possibly something going to the wrong direction. Quartz has a rich set of triggers that should cater for various scheduling needs which are based on interval/reoccurrence rules.

没有完全理解您的用例,我只是为启动和停止操作安排了两个触发器.您可以参数化触发器以通过作业数据映射(TurnOn、TurnOff)提供操作模式.您可以轻松地在每个星期一、星期三和星期六的上午 8 点 35 分等时间运行开始操作,并且相应的停止触发器会显示给定日期的晚上 10 点.

Not fully understanding your use case, I'd just schedule two triggers for start and stop actions. You could parametrize the triggers to supply the operation mode via job data map (TurnOn, TurnOff). You easily have start action to run on times like 8:35 am, every Monday, Wednesday and Saturday and corresponding stop trigger say the given dates on 10 pm.

这篇关于自定义 Quartz.Net 触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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