0

I am running into an issue setting the job data map for the trigger in Quartz. I know it's possible pro grammatically, but I need to do it in the xml jobs file. However, every time I try to add it to the trigger, it says that job-data-map is invalid. Looking at the XSD (http://www.quartz-scheduler.org/xml/job_scheduling_data_2_0.xsd) for the jobs file, it looks like it should be a valid child of the cron tag because it inherits abstractTriggerType, but my app won't accept it.

Here is my code. I am using Quartz.Net 2.0

<job>
  <name>StagingJob</name>
  <job-type>MyAssembly.StagingJob, MyAssembly</job-type>
  <durable>true</durable>
  <recover>false</recover>
</job>
<trigger>
  <cron>
    <name>StagingTrigger</name>
    <job-name>StagingJob</job-name>
    <misfire-instruction>SmartPolicy</misfire-instruction>
    <job-data-map>
      <entry>
        <key>end-time-cron</key>
        <value>0 59 * * * ?</value>
      </entry>
      <entry>
        <key>thread-count</key>
        <value>3</value>
      </entry>
    </job-data-map>
    <cron-expression>0 1 * * * ?</cron-expression>
  </cron>       
</trigger>

What is the correct way to add job data to the trigger via xml?

STW
  • 44,917
  • 17
  • 105
  • 161
Thinking Sites
  • 3,494
  • 17
  • 30

1 Answers1

1

Try removing the element misfire-instruction, smart policy is the default anyway. If you'd like to keep the element, it should come after the job-data-map element. Quartz is quite strict about ordering of XML elements.

Visual Studio should also give you intellisense with this document if you set Schemas in VS property window point to XSD file included in the distribution.

Marko Lahma
  • 6,586
  • 25
  • 29