Quartz.NET vs Windows Scheduled Tasks. How different are they?

柔情痞子 提交于 2019-12-17 18:37:09

问题


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,


回答1:


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.




回答2:


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.




回答3:


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.




回答4:


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:

  • https://github.com/dahall/taskscheduler
  • https://www.nuget.org/packages/TaskScheduler

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.



来源:https://stackoverflow.com/questions/5115105/quartz-net-vs-windows-scheduled-tasks-how-different-are-they

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!