支持回调或事件的商业.net任务调度程序组件

发布于 2024-11-07 08:26:48 字数 589 浏览 4 评论 0原文

我知道 quartz.net 和 codeplex 任务调度程序管理的包装项目。他们有相当不错的学习曲线和研发阶段,可以使其按照我们的规格工作。还包装它们&使用我们的运行时安装程序进行配置是另一个问题。因此我们决定使用商业 .NET 任务调度程序。

我们的要求是:

  1. 必须在 Win xp 和 Win 7 (x86 + x64) 上受支持
  2. 必须在触发触发器时提供回调或事件。

伪代码示例:

Trigger mytrigger = new Trigger(Daily, "8:00am", myCallbackDelegate);
mytrigger.Start();

每天 8:00 myCallbackDelegate 指向的方法将被调用。

调度程序可以作为服务运行,也可以在每次引用它的应用程序启动时运行。 可以放置在表单上并进行配置的 .NET 组件是首选。

请提供您的建议。我用谷歌搜索过,但找不到任何可以执行此基本功能的东西。谢谢

I am aware of quartz.net and the codeplex task scheduler managed wrapper project. They have a rather decent learning curve and R&D phase to get it to work as per our specs. Also packaging them & configuring with our runtime installer is another issue. So we have decided to go with a commercial .NET task scheduler.

Our requirements are:

  1. Must be supported on Win xp and Win 7 (x86 + x64)
  2. Must provide a callback or event when trigger is fired.

Sample psuedo code:

Trigger mytrigger = new Trigger(Daily, "8:00am", myCallbackDelegate);
mytrigger.Start();

Every day at 8:00 method pointed to by myCallbackDelegate will be called.

The scheduler can run as service or everytime the app that references it is started.
.NET component that can be dropped on the form and configured preferred.

Please provide your recommendations. I have googled and cannot find anything that will do this basic functionality. thanks

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

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

发布评论

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

评论(1

离旧人 2024-11-14 08:26:48

我在 WCF 服务中使用了 Quartz.Net,它运行得非常好,由于 Cron 触发器,它具有很大的灵活性,基本上你可以解决大多数调度场景,当你调度触发器时,你需要指定实现 IJob 接口的类的类型。就我而言,执行方法调用单例类/方法来完成它需要执行的工作。您可以将触发器配置为存储在 RAM(易失性)或数据库上,我认为您可以指定自定义存储,但我没有这样做。

我在 Quartz.NET 中遇到的唯一问题在这个问题中进行了描述,我还发布了我制定的解决方案,如果您有更具体的问题,请告诉我。

这是 Quartz.NET 的一些配置基础知识,主要来自教程。

为了实例化调度程序,你可以这样做:

ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
_scheduler = schedulerFactory.GetScheduler();
_scheduler.Start()

为了调度一个作业,你将做这样的事情

JobDetail jobDetail = new JobDetail("UNIQUE NAME", null, typeof(NotepadJob));
SimpleTrigger triggerToReturn = new SimpleTrigger();
triggerToReturn.StartTimeUtc = DateTime.Now.ToUniversalTime();
_scheduler.ScheduleJob(jobDetail,trigger);

,作业将是这样的

internal class NotepadJob : IJob
{
    //Open Notepad
}

如果使用 SQL,你可以在配置文件中按以下方式配置设置:

  <configSections>
      <section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  <\configSections>


<quartz>
  <add key="quartz.scheduler.instanceName" value="DefaultQuartzJobScheduler" />
  <add key="quartz.scheduler.instanceId" value="AUTO" />
  <add key="quartz.jobstore.clustered" value="true" />
  <add key="quartz.jobstore.clusterCheckinInterval" value="15000" />
  <add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
  <add key="quartz.jobStore.useProperties" value="false" />
  <add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
  <add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz" />
  <add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
  <add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />
  <add key="quartz.jobStore.misfireThreshold" value="60000" />
  <add key="quartz.jobStore.dataSource" value="default" />
  <add key="quartz.dataSource.default.connectionString" value="[CONNECTION STRING]" />
  <add key="quartz.dataSource.default.provider" value="SqlServer-20" />
  <add key="quartz.threadPool.threadCount" value="10" />
</quartz>

-问候

I have used Quartz.Net in a WCF Service and it has worked really good, it has lots of flexibility due to the Cron Triggers, basically you can work out most of the scenarios of scheduling, when you schedule a trigger, you need to specify a type of a class that implements the IJob Interface. In my case the Execute methods calls a singleton class/method to do the job it needs to perform. You can configure the Triggers to be stored on RAM (volatile) or a Database, i think you can specify a custom storage but i haven't go that way.

The only problem that i had with Quartz.NET is described in this question, I also posted the solution that i worked out, if you have more specific questions please let me know.

This is some of the configuration basics of Quartz.NET mosthly followed from the Tutorial

For instantiating the Scheduler you do something like this:

ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
_scheduler = schedulerFactory.GetScheduler();
_scheduler.Start()

For scheduling a job you will do something like this

JobDetail jobDetail = new JobDetail("UNIQUE NAME", null, typeof(NotepadJob));
SimpleTrigger triggerToReturn = new SimpleTrigger();
triggerToReturn.StartTimeUtc = DateTime.Now.ToUniversalTime();
_scheduler.ScheduleJob(jobDetail,trigger);

and the Job will be something like this

internal class NotepadJob : IJob
{
    //Open Notepad
}

If wokring with SQL you can configure the settings as followed on the Config file:

  <configSections>
      <section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  <\configSections>


<quartz>
  <add key="quartz.scheduler.instanceName" value="DefaultQuartzJobScheduler" />
  <add key="quartz.scheduler.instanceId" value="AUTO" />
  <add key="quartz.jobstore.clustered" value="true" />
  <add key="quartz.jobstore.clusterCheckinInterval" value="15000" />
  <add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
  <add key="quartz.jobStore.useProperties" value="false" />
  <add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
  <add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz" />
  <add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
  <add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />
  <add key="quartz.jobStore.misfireThreshold" value="60000" />
  <add key="quartz.jobStore.dataSource" value="default" />
  <add key="quartz.dataSource.default.connectionString" value="[CONNECTION STRING]" />
  <add key="quartz.dataSource.default.provider" value="SqlServer-20" />
  <add key="quartz.threadPool.threadCount" value="10" />
</quartz>

-Regards

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