使用 Quartz.net 配置 ADOJobStore [英] Configuring ADOJobStore with Quartz.net

查看:73
本文介绍了使用 Quartz.net 配置 ADOJobStore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How do you set up a jobstore with Quartz.net. The tutorial they have on the site is not that of help for me.

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

In this page though there are steps http://quartznet.sourceforge.net/tutorial/lesson_9.html I am not able to get how to set this one

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

谢谢

推荐答案

以下是 Quartz.NET 示例 13 中改编的程序化配置示例:

Here's an adapted example of programmatic configuration from Quartz.NET's example 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 文件)实现相同的目的.

You can also achieve the same thing with properties file based approach (the .config file).

Quartz 3.1 及更高版本的更新

如果您正在使用 Microsoft 依赖注入,您还可以使用 Quartz.NET 3.1 中引入的 fluent Microsoft DI 注册 API.请参阅配置指南 了解详情.

You can also use fluent Microsoft DI registration API introduced in Quartz.NET 3.1 if you have Microsoft dependency injection in use. See configuration guide for details.

这篇关于使用 Quartz.net 配置 ADOJobStore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆