Quartz 状态作业报告 [英] Quartz status job reporting

查看:54
本文介绍了Quartz 状态作业报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们需要通过只能访问数据库来监控石英作业的状态.石英是否提供了实现这一目标的方法?

阅读文档,在 Trigger 类中,我们有 TriggerState,它定义了各种状态、ERROR 和 COMPLETE 等.

但在常规执行期间,CompleteExecutionInstruction 始终为 NOOP.我是抛出异常还是完全执行都没有关系.如果我成功了,我期待像 COMPLETE 这样的东西,如果我抛出异常,我期待着 ERROR

有人有这方面的经验吗?

解决方案

触发器状态绝不会反映作业的最后执行状态,因此您不能期望触发器状态为 COMPLETE 或 ERROR.

如果你想监控你的工作,我建议你查看 Quartz .

We need to monitor the status of quartz jobs by only having access to the database. Does quartz offer a way to achieve this?

Reading the documentation, in the Trigger class we have TriggerState which defines various states, ERROR and COMPLETE among others.

But during regular execution, the CompleteExecutionInstruction is always NOOP. It doesn't matter if I throw an exception or execute completely. I was expecting something like COMPLETE if I was successful or ERROR if I threw an exception.

Does anyone have any experience with this?

解决方案

Trigger state in no way reflects the last execution status of your job so you cannot expect the trigger state to be COMPLETE or ERROR.

If you want to monitor your jobs, I recommend that you look into the Quartz JobListener interface. This interface allows you to intercept and process all job execution events that you may be interested in. For example, you may want to implement a job listener that stores the intercepted job execution events in a database and then you can query this database to obtain the last job execution status of your jobs etc.

You may also consider using an existing Quartz scheduler, job and trigger management and monitoring tool. I am the original author of QuartzDesk which is one of these tools. QuartzDesk is a completely non-intrusive tool that does not require you to modify your application code in any way, and it can work with all types of Java applications and nearly all Quartz versions. There is a public online demo that you can register to, try and see for yourself if the tool satisfies your requirements. When it comes to monitoring, the QuartzDesk GUI displays a so-called health indicator next to each job and trigger. This indicator depicts the status (success, error, veto) of the last 10 job/trigger executions so you can quickly see if there are any jobs that failed recently etc. You can also access complete execution history of individual jobs and trigger. If you want to be notified of any job execution related event, you can create an execution notification rule that will send you a notification message (IM, SMS, email, Slack, HipChat, SNMP Trap, ...) when a configured condition is met. I am attaching a screenshot of the GUI showing job health indicators and the selected job's execution history.

.

这篇关于Quartz 状态作业报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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