Quartz.NET configuration - does not interact with db

I am a complete noob for Quartz.net and I am recording Windows services, so I apologize if this question is a bit uninformed.

In any case, I configured the Windows service to use quartz.net to start another Windows service that does some file cleaning. It installs and works very well (at least according to the installutil and net start commands), but it never adds anything to the database.

I created db tables and that’s it, and db itself looks great. Then I created an app.config that contains (I think) all the configuration settings that I need to use in order to associate this thing with db. But for some reason, db never gets under way. No triggers were created (I obviously created them in the code), without jobs in the queue, nothing.

This is oracle db and all permissions are configured to allow read / write and that's it.

Here is the source code for app.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>

<quartz>

<add key="quartz.scheduler.instanceName" value="TestQuartzServer" />
<add key="quartz.scheduler.instanceId" value="instance_one" />
<add key="quartz.threadPool.threadCount" value="10" />
<add key="quartz.threadPool.threadPriority" value="Normal" />
<add key="quartz.jobStore.misfireThreshold" value="60000" />
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.useProperties" value="false" />
<add key="quartz.jobStore.dataSource" value="default" />
<add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
<add key="quartz.jobStore.clustered" value="true" />
<add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.SimpleSemaphore, Quartz" />
<add key="quartz.dataSource.default.connectionStringName" value="ConnectionString" />
<add key="quartz.dataSource.default.provider" value="OracleClient-20" />
<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz" />
</quartz>
 <connectionStrings>
    <add name="ConnectionString" connectionString= "Server=localhost;Database=Quartz;Uid=Quartz;Pwd=Quartz" />
</connectionStrings>
</configuration>

And here is the source of the application:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using Quartz;
using Quartz.Impl;
using Quartz.Impl.Triggers;
using System.Collections;

namespace PurgeScheduler1
{

    public partial class Service1 : ServiceBase
    {
        public static IScheduler _scheduler;
        public Service1()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            try {
            ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
            _scheduler = schedulerFactory.GetScheduler();
            _scheduler.Start();
            AddJob();
            }
            catch(Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }


        protected override void OnStop()
        {
        }

        public static void AddJob()
        {
            IJob myJob = new MyJob();
            JobDetailImpl jobDetail = new JobDetailImpl("Purge", "Group1", myJob.GetType());
            CronTriggerImpl trigger = new CronTriggerImpl("Trigger1", "Group1", "When to run it goes here");
            SimpleTriggerImpl trigger1 = new SimpleTriggerImpl("Trigger2", 10, TimeSpan.FromMinutes(2));
            _scheduler.ScheduleJob(jobDetail, trigger1);
            DateTimeOffset? nextFireTime = trigger.GetNextFireTimeUtc();
            Console.WriteLine("Next Fire Time:" + nextFireTime.Value);
        }
    }
    internal class MyJob : IJob
    {
        public void Execute(IJobExecutionContext context)
        {
            Console.WriteLine("In myJob class");
            Process.Start("correct path, but hiding it for proprietary reasons");
        }
    }
}
+3
source share
2 answers

quartz.dataSource.default.connectionStringName

The above should be: quartz.dataSource.default.connectionString

Try setting the parameter 'quartz.jobStore.clustered' to false. To narrow down potential problems.

installutil. quartz , topshelf. Topshelf windowservice, ServiceBase. , : Quartz.Server.exe/install, visual studio - .

https://github.com/quartznet/quartznet .: Quartz.Server.2010.sln

, .

+2

handeler configSections app.config:

<configSections>
     <section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</configSections>

. NLog. .

+1

All Articles