【问题标题】:Configuring ADOJobStore with Quartz.net使用 Quartz.net 配置 ADOJobStore
【发布时间】:2009-09-21 17:46:31
【问题描述】:

您如何使用 Quartz.net 设置作业存储。他们在网站上的教程对我没有帮助。

在这个页面虽然有步骤 http://quartznet.sourceforge.net/tutorial/lesson_9.html 我不知道如何设置这个

org.quartz.jobStore.type = Quartz.Impl.AdoJobStore.JobStoreTX, Quartz 

谢谢

【问题讨论】:

标签: quartz-scheduler quartz.net


【解决方案1】:

这是 Quartz.NET 的示例 13 中改编的编程配置示例:

NameValueCollection properties = new NameValueCollection();

properties["quartz.scheduler.instanceName"] = "TestScheduler";
properties["quartz.scheduler.instanceId"] = "instance_one";
properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
properties["quartz.jobStore.useProperties"] = "true";
properties["quartz.jobStore.dataSource"] = "default";
properties["quartz.jobStore.tablePrefix"] = "QRTZ_";
// if running MS SQL Server we need this
properties["quartz.jobStore.lockHandler.type"] = "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz";

properties["quartz.dataSource.default.connectionString"] = "Server=(local);Database=quartz;Trusted_Connection=True;";
properties["quartz.dataSource.default.provider"] = "SqlServer-20";

// First we must get a reference to a scheduler
ISchedulerFactory sf = new StdSchedulerFactory(properties);
IScheduler sched = sf.GetScheduler();

您也可以使用基于属性文件的方法(.config 文件)实现相同的目的。

Quartz 3.1 及更高版本的更新

如果您正在使用 Microsoft 依赖注入,您还可以使用 Quartz.NET 3.1 中引入的 fluent Microsoft DI 注册 API。详情请见configuration guide

【讨论】:

  • Marko 感谢您的回复。我创建了所有表,但在 QRTZ_Triggers 表中 start_Time 和 End_Time 是大 int 列 如何将开始时间指定为 11:30 或 14:25?在获得调度程序的实例后,我是否需要循环访问数据库中的触发器?或者你有什么例子吗
  • 您应该通过调度程序接口进行所有更改,您不应该直接在数据库中更改表内容。如果您使用 JobStoreTX,触发器和作业详细信息将保存在数据库中。
  • Marko:“调度程序接口”是什么意思?我已经下载了解决方案,但没有 GUI 项目。该解决方案有两个类库项目,一个控制台应用程序和一个 Windows 服务。据我所知,控制台只是启动与服务相同的进程。感谢您对此的帮助。
  • 您应该能够使用配置文件中的 部分并使用标准 列出所有这些属性图案。那么你根本不需要编程配置。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多