0

Quartz .NET を使い始めたばかりです。最初に私はいくつかのコードを開発し、コードでジョブとトリガーをスケジュールしました。

            var job = JobBuilder.Create<MetaFileEngine>()
                .WithIdentity("MetaFileJob", "ThunderheadOutput")
                .Build();
            job.JobDataMap.Put("Repository", repository);
            var trigger = (ICronTrigger)TriggerBuilder.Create()
                             .WithIdentity("trigger1", "group1")
                             .WithCronSchedule("0,15 * 06-22 * * ?")
                             .Build(); 

しかし、より柔軟にするために、XML ジョブ スケジューリングを使用したいと考えました。しかし、実行しても何も起こりませんでした。作成されたジョブも表示されませんが、エラーもありません。

コードは次のとおりです。

NameValueCollection properties = new NameValueCollection();
            properties["quartz.scheduler.instanceName"] = "XmlConfiguredInstance";

            // set thread pool info
            properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
            properties["quartz.threadPool.threadCount"] = "5";
            properties["quartz.threadPool.threadPriority"] = "Normal";

            // 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"] = AppConfigHelper.Get("QaurtzXMLSchedule", string.Empty);


            ISchedulerFactory sf = new StdSchedulerFactory(properties);

そして私の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>
      <name>MetaFileJob</name>
      <group>ThunderheadOutput</group>
      <description>process Metafiles generated by TH to tell where the letter was archived</description>
      <job-type>JE.Task.LMS.MetaFileEngine, JE.Task.LMS</job-type>
      <durable>false</durable>
      <recover>false</recover>
      <job-data-map>
        <entry>
          <key>key0</key>
          <value>value0</value>
        </entry>
        <entry>
          <key>key1</key>
          <value>value1</value>
        </entry>
        <entry>
          <key>key2</key>
          <value>value2</value>
        </entry>
      </job-data-map>
    </job>
    <trigger>
      <cron>
        <name>MetaFileTrigger</name>
        <group>ThunderheadOutput</group>
        <description>MetaFileTrigger Schedule</description>
        <job-name>MetaFileJob</job-name>
        <job-group>ThunderheadOutput</job-group>        
        <misfire-instruction>SmartPolicy</misfire-instruction>
        <cron-expression>0,15 * 06-22 * * ?</cron-expression>
      </cron>
    </trigger>
  </schedule>
</job-scheduling-data>

どんな洞察も大歓迎です。

4

1 に答える 1

0

私のコードのどれも実際にdllから何かを呼び出していなかったので、問題はexe binフォルダーにdllをロードしていなかったということでした。手動でexe binフォルダーに移動すると、機能し始めました。

于 2013-10-09T18:09:10.203 に答える