誰かが私が間違っていることについてアドバイスできますか? 起動時にxml構成ファイルを読み取るようにクォーツをセットアップしようとしています。ファイル内には、クラスをアクティブ化するジョブがありますHelloEmail_Job.cs
(正しく作成さIJob
れ、execute メソッドのロジックで拡張されます)。xml には、毎分起動するジョブの cron トリガーもあります (純粋にテスト用です)。
しかし、すべてがエラーなしで起動しますが、ジョブは起動しません。私は間違って設定していると確信しています。
スケジューラーの生成を処理するシングルトンがあり、スケジューラーはアプリの起動時に開始されます (global.asax
ファイル内) 。
NameValueCollection properties = new NameValueCollection();
properties["quartz.scheduler.instanceName"] = "RemoteServer";
////// set thread pool info
properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
properties["quartz.threadPool.threadCount"] = "5";
properties["quartz.threadPool.threadPriority"] = "Normal";
properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
properties["quartz.jobStore.useProperties"] = "true";
properties["quartz.jobStore.dataSource"] = "default";
properties["quartz.jobStore.tablePrefix"] = "QRTZ_";
properties["quartz.jobStore.lockHandler.type"] = "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz";
properties["quartz.dataSource.default.connectionString"] = "Data Source=CRAIG-PC\\SQLEXPRESS;Initial Catalog=MCWdb;User ID=sa;Password=mastercrud;";
properties["quartz.dataSource.default.provider"] = "SqlServer-20";
// job initialization plugin handles our xml reading, without it defaults are used
properties["quartz.plugin.xml.type"] = "Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz";
properties["quartz.plugin.xml.fileNames"] = "~/quartz_jobs.xml";
ISchedulerFactory sf = new StdSchedulerFactory(properties);
_sched = sf.GetScheduler();
私のquartz_jobs.xml
ファイルは次のようになります。
<?xml version="1.0" encoding="UTF-8"?>
<job-scheduling-data xmlns="http://quartznet.sourceforge.net/JobSchedulingData"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.0">
<processing-directives>
<overwrite-existing-data>true</overwrite-existing-data>
</processing-directives>
<schedule>
<job>
<job-detail>
<name>MyJob</name>
<group>MyJobs</group>
<description>sends out a test email</description>
<job-type>HelloEmail_Job</job-type>
<volatile>false</volatile>
<durable>true</durable>
<recover>false</recover>
<job-data-map>
<entry>
<key>Body</key>
<value>Hello From your website!!!!!!!!</value>
</entry>
</job-data-map>
</job-detail>
<trigger>
<cron>
<name>MyJobTrigger</name>
<group>MyJobs</group>
<description>A description</description>
<job-name>MyJob</job-name>
<job-group>MyJobs</job-group>
<cron-expression>0 0/1 * 1/1 * ? *</cron-expression>
</cron>
</trigger>
</job>
</schedule>
</job-scheduling-data>
アプリがそれらを作成して動的にスケジュールすると、完全に機能するため、単純なトリガーを使用してアドホックジョブに対してスケジューラが正しく実行されていることがわかっています。しかし、ロジックを(cronを介して)繰り返し可能にし、xmlを介して構成可能にしたいと考えています。
私の直感は、JOB_TYPE の値が間違っているということです。