quartz scheduler触发历史记录需要在触发后保存在数据库中

时间:2014-03-22 05:21:49

标签: quartz-scheduler

我使用CronTriggerBean和SimpleTriggerBean石英调度程序来执行触发器。永久执行触发器后不保存有关触发器的详细信息。在执行之前存储触发器数据在执行之后被删除有什么问题。为此我正在使用代码。

 <prop   key="org.quartz.plugin.triggHistory.class">org.quartz.plugins.history.LoggingTriggerHistoryPlugin</prop>    
    <prop key="org.quartz.plugin.triggHistory.triggerFiredMessage">Trigger {1}.{0} fired job {6}.{5} at: {4, date, HH:mm:ss dd/MM/yyyy}</prop>
    <prop key="org.quartz.plugin.triggHistory.triggerCompleteMessage">Trigger {1}.{0} completed firing job {6}.{5} at {4, date, HH:mm:ss dd/MM/yyyy} with resulting trigger instruction code: {9}</prop>
    <prop key="org.quartz.plugin.triggHistory.triggerMisfiredMessage">Trigger [{1}.{0}] misfired job [{6}.{5}]. Should have fired at: {3, date, dd-MM-yyyy HH:mm:ss.SSS}</prop>
    <prop key="org.quartz.plugin.jobHistory.class">org.quartz.plugins.history.LoggingJobHistoryPlugin</prop>
    <prop key="org.quartz.plugin.jobHistory.jobToBeFiredMessage">Job [{1}.{0}] to be fired by trigger [{4}.{3}], re-fire: {7}</prop>
    <prop key="org.quartz.plugin.jobHistory.jobSuccessMessage">Job {1}.{0} fired at: {2, date, dd/MM/yyyy HH:mm:ss} result=OK</prop>
    <prop key="org.quartz.plugin.jobHistory.jobFailedMessage">Job {1}.{0} fired at: {2, date, dd/MM/yyyy HH:mm:ss} result=ERROR</prop>
    <prop key="org.quartz.plugin.jobHistory.jobWasVetoedMessage">Job [{1}.{0}] was vetoed. It was to be fired by trigger [{4}.{3}] at: {2, date, dd-MM-yyyy HH:mm:ss.SSS}</prop>

1 个答案:

答案 0 :(得分:0)

您需要创建一个新的pluginHistoty,它会保存在db中并使用它而不是org.quartz.plugins.history。

LoggingInDbTriggerHistoryPlugin : ISchedulerPlugin, ITriggerListener
...

public virtualvoid TriggerComplete(..){
   //save in db
}