Click here to Skip to main content
15,880,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a program that executes several tasks at a specific time everyday. I have refactored the application to run as a Quartz job using the Quartz windows service. When i start the Quartz Server service in Windows services i get error :
Error 1053 :The service did not respond in a timely fashion

and when i inspect the Quartz logs at C:\Program Files (x86)\Quartz.Net\Trace\application.log i get :
HTML
15:13:54 [ServerScheduler_QuartzSchedulerThread] DEBUG Quartz.Core.QuartzSchedulerThread - Batch
   acquisition of 1 triggers
   15:13:54 [ServerScheduler_Worker-6] DEBUG Quartz.Core.JobRunShell - Calling Execute on job
   sampleGroup.sampleJob
   15:13:54 [ServerScheduler_Worker-6] INFO  Quartz.Server.SampleJob - SampleJob running...
  15:13:59 [ServerScheduler_Worker-6] INFO  Quartz.Server.SampleJob - SampleJob run finished.
   15:13:59 [ServerScheduler_Worker-6] DEBUG Quartz.Core.JobRunShell - Trigger instruction :
   NoInstruction
   15:14:04 [ServerScheduler_QuartzSchedulerThread] DEBUG Quartz.Simpl.SimpleJobFactory - Producing
   instance of Job 'sampleGroup.sampleJob', class=Quartz.Server.SampleJob
   15:14:04 [ServerScheduler_QuartzSchedulerThread] DEBUG Quartz.Core.QuartzSchedulerThread - Batch
   acquisition of 1 triggers
   15:14:04 [ServerScheduler_Worker-7] DEBUG Quartz.Core.JobRunShell - Calling Execute on job
   sampleGroup.sampleJob
   15:14:04 [ServerScheduler_Worker-7] INFO  Quartz.Server.SampleJob - SampleJob running...
   15:14:09 [ServerScheduler_Worker-7] INFO  Quartz.Server.SampleJob - SampleJob run finished.
   15:14:09 [ServerScheduler_Worker-7] DEBUG Quartz.Core.JobRunShell - Trigger instruction :
   NoInstruction


I have followed the guide from this article here Running Quartz jobs sequentially
For now it appears the Quartz Server is still referring to the built-in job that comes with the installation and its also not recognizing any of the edits i have done.

What i have done

1. Built my Class Library project in release mode and copied the resultant dll to C:\Program Files (x86)\Quartz.Net as in the guide here https://www.codeproject.com/Articles/1017396/Running-jobs-sequentially-using-Quartz-Net-with-th

2. Updated quartz_jobs.xml by adding entries for my program :
XML
   <job>
<name>JobOne</name>
<group>JobOneGroup</group>
<description>Sample job for Quartz Server</description>
<job-type>CheckListDemo.JobOne, CheckListDemo</job-type>
<durable>true</durable>
<recover>false</recover>
  <job-data-map>
<entry>
  <key>NextJobName</key>
  <value>JobTwo</value>
</entry>
    <trigger>
      <simple>
<name>jobOneTrigger</name>
<group>jobOneTriggerGroup</group>
<description>Simple trigger to simply fire sample job</description>
<job-name>JobOne</job-name>
<job-group>JobOneGroup</job-group>
<misfire-instruction>SmartPolicy</misfire-instruction>
<repeat-count>-1</repeat-count>
<repeat-interval>10000</repeat-interval>


3. Added empty constructor for job initialization in all my Job implementation classes
4. Created a plugin and added its reference in quartz.xml as :
HTML
# job initialization plugin handles adding a listener for our jobs
 quartz.plugin.PluginExample.type = CheckListDemo.PluginExample, CheckListDemo

5. Added a plugin class (PluginExample.cs)
6. I have added the job implementation classes .The classes simply write some text to a named folder :
C#
  class JobTwo :IJob
     {
         public JobTwo()
         {

         }

public void Execute(IJobExecutionContext context)
{
    Console.WriteLine("Job two started");
    string realPath = @"C:\Users\user\Documents\FILES";
    string appLog = "JobTWO";

    var logPath = realPath + Convert.ToString(appLog) + DateTime.Today.ToString("dd -MM-yy") + ".   txt";
    if (!File.Exists(logPath))
    {
        File.Create(logPath).Dispose();
    }

    List<string> keys = new List<string>() { "TYPE", "SIGNATURE", "COMPANY", "CLIENT NAME" };

    foreach (string key in keys)
    {
        using (StreamWriter sw = File.AppendText(logPath))
        {
            sw.WriteLine(key);
            sw.Flush();
            sw.Close();
        }

    }

    System.Threading.Thread.Sleep(10000);
    Console.WriteLine("Job TWO finished");
}


7. Added a job listener with the requisite entries for my jobs and trigger I have verified in a separate console program that the code can indeed write to the locations im am specifying which leaves the Quartz Server itself as the issue.

What am i missing?

Is there any additional configuration required so that the server picks up my dll and the specified jobs.

What I have tried:

I have tried running the Quartz Service normally without my dll and it runs perfectly.

But as soon as i add my dll and the amendements to quartz installation files i get issues.
Posted
Updated 19-Jul-20 6:38am
Comments
F-ES Sitecore 20-Jul-20 12:53pm    
Have you added anything to the "Start" event of the service?

1 solution

You should post your question in the forum at the end of the article so the author can respond.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900