Quartz.NET 与 Windows 计划任务。他们有什么不同?

发布于 2024-10-19 07:34:38 字数 164 浏览 5 评论 0 原文

我正在寻找 Quartz.NET 和 Windows 计划任务之间的比较?

他们有什么不同?每一种的优点和缺点是什么?我该如何选择使用哪一个?

TIA,

I'm looking for some comparison between Quartz.NET and Windows Scheduled Tasks?

How different are they? What are the pros and cons of each one? How do I choose which one to use?

TIA,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

洒一地阳光 2024-10-26 07:34:38

使用 Quartz.NET,我可以对比之前的一些观点:

  1. 编写代码 - 您可以用 .NET 语言表达您的意图,编写单元测试并调试逻辑
  2. 与事件日志集成,您可以使用 Common.Logging 甚至允许写入db..
  3. 也健壮且可靠
  4. 甚至更丰富的 API

这主要是关于您需要什么的问题。 Windows 计划任务可能会为您提供所需的一切。但是,如果您需要集群(分布式工作人员)、对触发或失火处理规则的细粒度控制,您可能需要检查 Quartz.NET 在这些领域提供的功能。

采用最简单的方法来满足您的要求,但足够抽象以允许更改。

With Quartz.NET I could contrast some of the earlier points:

  1. Code to write - You can express your intent in .NET language, write unit tests and debug the logic
  2. Integration with event log, you have Common.Logging that allows to write even to db..
  3. Robust and reliable too
  4. Even richer API

It's mostly a question about what you need. Windows Scheduled tasks might give you all you need. But if you need clustering (distributed workers), fine-grained control over triggering or misfire handling rules, you might like to check what Quartz.NET has to offer on these areas.

Take the simplest that fills your requirements, but abstract enough to allow change.

烟雨扶苏 2024-10-26 07:34:38

我的直觉反应是,在安装另一个调度程序之前,首先尝试让集成的 WinScheduler 满足您的需求 - 推理:

  1. 无需安装 - 默认安装并启用,
  2. 无需编写代码 - 作业表示为
  3. 与事件日志集成的元数据等。
  4. 健壮可靠 - 对于 MSFT、Google 等来说足够好
  5. 相当丰富的 API - 创建作业、检查状态等
  6. 与远程管理工具集成 安全集成
  7. 中运行作业
  8. - 在不同的凭据监控工具

如果 Quartz 不能满足您的需求,请使用 Quartz 。 Quartz 当然也有许多这样的功能,但如果可以的话,不要再添加另一个服务来拥有和管理。

My gut reaction would be to try and get the integral WinScheduler to work with your needs first before installing yet another scheduler - reasoning:

  1. no installation required - installed and enabled by default
  2. no code to write - jobs expressed as metadata
  3. integration with event log etc.
  4. robust and reliable - good enough for MSFT, Google etc.
  5. reasonably rich API - create jobs, check status etc.
  6. integrated with remote management tools
  7. security integration - run jobs in different credentials
  8. monitoring tooling

Then reach for Quartz if it doesn't meet your needs. Quartz certainly has many of these features too, but resist adding yet another service to own and manage if you can.

只为守护你 2024-10-26 07:34:38

对我来说,其他答案中未包含的一个重要区别是调度程序执行的内容。

Windows 任务计划程序只能运行可执行程序和脚本。为在 Quartz 中使用而编写的代码可以直接与项目的 .NET 组件交互。

使用任务计划程序,您必须编写 shell 可执行文件或脚本。在该 shell 内,您可以与项目的组件进行交互。虽然编写此 shell 代码并不是一个困难的过程,但您确实必须考虑部署额外的文件。

如果您预计在项目的生命周期内添加更多计划任务,则最终可能需要创建额外的可执行 shell 或脚本文件,这需要更新部署过程。使用 Quartz,您不需要这些文件,这减少了创建和部署其他任务所需的总工作量。

One important distinction, for me, that is not included in the other answers is what gets executed by the scheduler.

Windows Task Scheduler can only run executable programs and scripts. The code written for use within Quartz can directly interact with your project's .NET components.

With Task Scheduler, you'll have to write a shell executable or script. Inside of that shell, you can interact with your project's components. While writing this shell code is not a difficult process, you do have to consider deploying the extra files.

If you anticipate adding more scheduled tasks over the lifetime of the project, you may end up needing to create additional executable shells or script files, which requires updates to the deployment process. With Quartz, you don't need these files, which reduces the total effort needed to create and deploy additional tasks.

诺曦 2024-10-26 07:34:38

不幸的是,如果不重新启动进程/主机/服务,Quartz.NET 作业程序集就无法更新。对于某些人(包括我自己)来说,这是一个相当大的问题。

完全有可能为在任务计划程序下运行的作业构建一个框架。基于 MEF 的程序集可以由单个控制台应用程序调用,所有内容都通过配置 UI 进行管理。这是一个流行的托管包装器:

我确实很享受使用 Quart.NET 的短暂时光,但重启要求是一个太大的问题,难以克服。多年来,Marko 在这方面做得非常出色,而且他总是乐于助人且反应灵敏。也许有一天,该项目将获得多个 AppDomain 支持,这将解决这个问题。 (也就是说,这肯定需要大量工作。如果他和他的贡献者决定接受它,我会向他们表示敬意。)

如果您需要的话,可以套用 Marko 的话:

  1. 集群(分布式工作人员)
  2. 对触发或失火处理的细粒度控制规则

...那么 Quartz.NET 将是您的要求。

Unfortunately, Quartz.NET job assemblies can't be updated without restarting the process/host/service. That's a pretty big one for some folks (including myself).

It's entirely possible to build a framework for jobs running under Task Scheduler. MEF-based assemblies can be called by a single console app, with everything managed via a configuration UI. Here's a popular managed wrapper:

I did enjoy my brief time of working with Quart.NET, but the restart requirement was too big a problem to overcome. Marko has done a great job with it over the years, and he's always been helpful and responsive. Perhaps someday the project will get multiple AppDomain support, which would address this. (That said, it promises to be a lot of work. Kudos to he and his contributors if they decide to take it on.)

To paraphrase Marko, if you need:

  1. Clustering (distributed workers)
  2. Fine-grained control over triggering or misfire handling rules

...then Quartz.NET will be your requirement.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文