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

后端 未结 4 1353
遥遥无期
遥遥无期 2020-12-09 08:43

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 whic

相关标签:
4条回答
  • 2020-12-09 08:51

    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.

    0 讨论(0)
  • 2020-12-09 09:02

    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.

    0 讨论(0)
  • 2020-12-09 09:12

    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.

    0 讨论(0)
  • 2020-12-09 09:14

    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.

    0 讨论(0)
提交回复
热议问题