首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Quartz XML调度无作业执行

使用Quartz XML调度无作业执行
EN

Stack Overflow用户
提问于 2013-10-08 03:34:48
回答 1查看 1.1K关注 0票数 0

我刚刚开始使用Quartz .NET。首先,我开发了一些代码,并在代码中调度作业和触发器,效果很好:

代码语言:javascript
复制
            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作业调度。但是当我运行它的时候什么也没发生。我甚至看不到创建的作业,但也没有错误。

代码如下:

代码语言:javascript
复制
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:

代码语言:javascript
复制
<?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>

任何洞察力都将不胜感激。

EN

回答 1

Stack Overflow用户

发布于 2013-10-10 02:09:10

问题最终是它没有将dll加载到exe bin文件夹中,因为我的代码实际上没有调用dll中的任何内容。一旦我手动将它移动到exe bin文件夹中,它就开始工作了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19233075

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档