Unable to save anything to the Quartz.net ado store

quartz net docker
git quartz net
quartz .net source code
quartz-net github
quartz documentation
net core scheduler github
.net core scheduler github

Just starting out with Quartz.Net. So please dont mind the rookie question.

I have searched SO but apparently, I couldn't find someone facing the same problem. I am using MySQL for my Quartz.Net ADO store. I am able to run the service successfully and also fire jobs using the scheduler. But nothing gets logs into the Database. I checked if the DB is getting picked up by using a false password and the Scheduler service fails to start. So the Store is being picked by the service but the jobs which are fired are not being logged. I am not sure why.

These are the properties of my Scheduler Service.

  <quartz >
    <add key="quartz.scheduler.instanceName" value="AbACScheduler"/>
    <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.driverDelegateType" value="Quartz.Impl.AdoJobStore.MySQLDelegate, Quartz"/>
    <add key="quartz.jobStore.dataSource" value="default"/>
    <add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz"/>
    <add key="quartz.dataSource.default.connectionString" value="Server=localhost;Database=quartz;Uid=xxx;Pwd=xxx;"/>
    <add key="quartz.jobStore.tablePrefix" value="qrtz_"/>
    <add key="quartz.dataSource.default.provider" value="MySql-50"/>
    <add key="quartz.jobStore.useProperties" value="true"/>
  </quartz>

The table prefix is also correct and I am using the 5.0 MySQL connector.

This is my Small test Console code for testing the service.

 private static void Main(string[] args)
    {
        try
        {
            Common.Logging.LogManager.Adapter = new Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter { Level = Common.Logging.LogLevel.Info };

            // Grab the Scheduler instance from the Factory 
            IScheduler scheduler = GetScheduler();

            // and start it off
            scheduler.Start();

            // define the job and tie it to our HelloJob class
            IJobDetail job = JobBuilder.Create<HelloJob>()
                .WithIdentity("job1", "group1")
                .Build();

            // Trigger the job to run now, and then repeat every 10 seconds
            ITrigger trigger = TriggerBuilder.Create()
                .WithIdentity("trigger1", "group1")
                .StartNow()
                .WithSimpleSchedule(x => x
                    .WithIntervalInSeconds(10)
                    .RepeatForever())
                .Build();

            // Tell quartz to schedule the job using our trigger
            scheduler.ScheduleJob(job, trigger);

            // some sleep to show what's happening
            Thread.Sleep(TimeSpan.FromSeconds(60));

            // and last shut down the scheduler when you are ready to close your program
            scheduler.Shutdown();
        }
        catch (SchedulerException se)
        {
            Console.WriteLine(se);
        }

        Console.WriteLine("Press any key to close the application");
        Console.ReadKey();
    }
    private static IScheduler GetScheduler()
    {
        try
        {
            var properties = new NameValueCollection();
            properties["quartz.scheduler.instanceName"] = "AbACScheduler";
            properties["quartz.dataSource.default.provider"] ="MySql-50";
            properties["quartz.scheduler.proxy.address"] = string.Format(@"tcp://{0}:{1}/{2}", "localhost", "555",
                                                                         "AbACScheduler");

            // Get a reference to the scheduler
            var sf = new StdSchedulerFactory(properties);

            return sf.GetScheduler();

        }
        catch (Exception ex)
        {
            Console.WriteLine("Scheduler not available: '{0}'", ex.Message);
            throw;
        }
    }

This is my HelloJob (taken from quartz.Net)

public class HelloJob : IJob
    {
        public void Execute(IJobExecutionContext context)
        {
            Console.WriteLine("Greetings from HelloJob!");
        }
    }

I took the DB script for creating ADOStore for MySQL, which came along with the Quartz.Net Source files.

IS there anything which I am doing wrong? Please guide me.

Thanks!


Comparing my working AdoJobStore (but with sql server)........to yours, I see the following items missing.

<add key="quartz.scheduler.instanceName" value="ExampleDefaultQuartzSchedulerInstanceName"/>
<add key="quartz.scheduler.instanceId" value="instance_one"/>
<add key="quartz.threadPool.threadCount" value="10"/>
<add key="quartz.threadPool.threadPriority" value="Normal"/>

Now I have this:

<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz"/>

and you have:

Is there a MySql specific one?

Here is my full setup, with sql server, but maybe you can start with this and plug in the mysql values.

<add key="quartz.scheduler.instanceName" value="ExampleDefaultQuartzSchedulerFromConfigFileSqlServer"/>
<add key="quartz.scheduler.instanceId" value="instance_one"/>
<add key="quartz.threadPool.threadCount" value="10"/>
<add key="quartz.threadPool.threadPriority" value="Normal"/>

<!-- 
org.quartz.scheduler.idleWaitTime
Is the amount of time in milliseconds that the scheduler will wait before re-queries for available triggers when the scheduler is otherwise idle. Normally you should not have to 'tune' this parameter, unless you're using XA transactions, and are having problems with delayed firings of triggers that should fire immediately.
It defaults to every 30 seconds until it finds a trigger. Once it finds any triggers, it gets the time of the next trigger to fire and stops checking until then, unless a trigger changes.   -->
<add key="quartz.scheduler.idleWaitTime" value ="5000"/>

<!-- Misfire : see http://nurkiewicz.blogspot.com/2012/04/quartz-scheduler-misfire-instructions.html  -->
<add key="quartz.jobStore.misfireThreshold" value="60000"/>
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz"/>
<add key="quartz.jobStore.tablePrefix" value="QRTZ_"/>
<add key="quartz.jobStore.clustered" value="false"/>
<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz"/>


<add key="quartz.jobStore.dataSource" value="MySqlServerFullVersion"/>
<add key="quartz.jobStore.useProperties" value="false"/>

<add key="quartz.dataSource.MySqlServerFullVersion.connectionString" value="SuperSecret!!"/>
<add key="quartz.dataSource.MySqlServerFullVersion.provider" value="SqlServer-20"/>

EDIT

Here is my full code......as an FYI.

            NameValueCollection config = (NameValueCollection)ConfigurationManager.GetSection("quartz");
            ISchedulerFactory factory = new StdSchedulerFactory(config);
            IScheduler sched = factory.GetScheduler();

            try
            {

                sched.Clear();

                /* schedule some jobs through code */

                sched.Start();

                Thread.Sleep(TimeSpan.FromSeconds(1));

                Console.WriteLine(string.Empty);
                Console.WriteLine("Press ENTER to Continue to Shut Down");
                Console.WriteLine(string.Empty);
                Console.ReadLine();

            }
            finally
            {
                sched.Shutdown(false);
            }


            Console.Write("");

        }
        catch (Exception ex)
        {

            Exception exc = ex;
            while (null != exc)
            {
                Console.WriteLine(exc.Message);
                exc = exc.InnerException;
            }
        }
        finally
        {
            Console.WriteLine(string.Empty);
            Console.WriteLine(string.Empty);
            Console.WriteLine("Press ENTER to Exit");
            Console.ReadLine();
        }

I just checked. The [QRTZ_FIRED_TRIGGERS] "cleans up after itself". It does NOT keep a full history.

I've run thousands of jobs on my dev environment, but that table has one row in it.

Note the below code in StdAdoConstants.cs

        public static readonly string SqlDeleteFiredTrigger =
            string.Format(CultureInfo.InvariantCulture, "DELETE FROM {0}{1} WHERE {2} = {3} AND {4} = @triggerEntryId", 
            TablePrefixSubst, TableFiredTriggers,ColumnSchedulerName, SchedulerNameSubst, ColumnEntryId);

        public static readonly string SqlDeleteFiredTriggers =
            string.Format(CultureInfo.InvariantCulture, "DELETE FROM {0}{1} WHERE {2} = {3}", TablePrefixSubst, TableFiredTriggers, ColumnSchedulerName, SchedulerNameSubst);

        public static readonly string SqlDeleteInstancesFiredTriggers =
            string.Format(CultureInfo.InvariantCulture, "DELETE FROM {0}{1} WHERE {2} = {3} AND {4} = @instanceName", TablePrefixSubst, TableFiredTriggers, ColumnSchedulerName, SchedulerNameSubst,
                          ColumnInstanceName);

Lesson 9: JobStores, ADO.NET Job Store (AdoJobStore) This prefix can actually be anything you'd like, as long as you inform AdoJobStore what the prefix is (in� To use RAMJobStore (and assuming you're using StdSchedulerFactory) you don't need to do anything special. Default configuration of Quartz.NET uses RAMJobStore as job store implementation. # ADO.NET Job Store (AdoJobStore) AdoJobStore is also aptly named - it keeps all of its data in a database via ADO.NET.


I had to change my GetScheduler to include the properties directly. Not sure why the properties which were defined at the creation of the Window Service is not being picked up.

Could someone please care to explain why this was not working in the first place as ideally the properties must be picked up when I instantiate the scheduler pointing to the scheduler being served by the windows service, right?

EDIT: Neater implementation is to use use a config file. This got me bummed. Sorry for the rookie question.

private static IScheduler GetScheduler()
        {
            try
            {
                var properties = new NameValueCollection();
                properties["quartz.scheduler.instanceName"] = "AbACScheduler";
                properties["quartz.scheduler.instanceId"] = "instance_one";
                properties["quartz.threadPool.threadCount"] = "10";
                properties["quartz.threadPool.threadPriority"] = "Normal";

                properties["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.MySQLDelegate, Quartz";
                properties["quartz.jobStore.dataSource"] = "default";
                properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
                properties["quartz.dataSource.default.connectionString"] = "Server=localhost;Database=quartz;Uid=xxx;Pwd=xxx;";
                properties["quartz.jobStore.tablePrefix"] = "qrtz_";
                properties["quartz.dataSource.default.provider"] = "MySql-50";
                properties["quartz.jobStore.useProperties"] = "true";
                properties["quartz.scheduler.proxy.address"] = string.Format(@"tcp://{0}:{1}/{2}", "localhost", "555",
                                                                             "AbACScheduler");

                // Get a reference to the scheduler
                var sf = new StdSchedulerFactory(properties);

                return sf.GetScheduler();

            }
            catch (Exception ex)
            {
                Console.WriteLine("Scheduler not available: '{0}'", ex.Message);
                throw;
            }
        }

Quartz.NET Configuration Reference, If that fails, then the quartz.config file located (as an embedded resource) AdoJobStore is used to store scheduling information (job, triggers and be anything you want, and has no meaning other than being able to identify� We request a feature implementation so that Quartz will recognize it is offline, stop trying to service more triggers or access the database in any way, and store trigger states until the database comes online again, maybe even minutes in the future. Below is an example of an outage that caused four trigger states to get corrupted.


Dot Net core, Mysql, Quartz 3.0.7.

In my case, I can save Trigger and job in Table but the problem triggers not hitting. when I am not using LoadQuartzProperties().then it working fine can anybody tell me what is wrong in LoadQuartzProperties() Method?

 private NameValueCollection LoadQuartzProperties()

{

            var NameValueCollection = new NameValueCollection();
            NameValueCollection.Add("quartz.scheduler.instanceName", "HomeScheduler");
            NameValueCollection.Add("quartz.scheduler.instanceId", "Instance");
            NameValueCollection.Add("quartz.jobStore.type", "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz");
            NameValueCollection.Add("quartz.jobStore.driverDelegateType", "Quartz.Impl.AdoJobStore.MySQLDelegate, Quartz");
            NameValueCollection.Add("quartz.jobStore.useProperties", "false");
            NameValueCollection.Add("quartz.jobStore.dataSource", "Home");
            NameValueCollection.Add("quartz.jobStore.tablePrefix", "QRTZ_");
            NameValueCollection.Add("quartz.dataSource.Home.provider", "MySql");
            NameValueCollection.Add("quartz.dataSource.Home.connectionString", "server=ser...;database=...;user=...;pwd=...;TreatTinyAsBoolean=false");
            NameValueCollection.Add("quartz.threadPool.threadCount", "50");
            NameValueCollection.Add("quartz.threadPool.threadPriority", "10");
            NameValueCollection.Add("quartz.serializer.type", "json");           
            return NameValueCollection;
}

Quartz.NET - [quartznet:4243] Alternative web UI (Quartzmin), NET. Most advanced right now is probably CrystalQuartz which is The most crucial for me is to put strongly typed values to JobDataMap and this was impossible with existing UI. Can I save the changes to reliable storage, for example to any you can configure AdoJobStore following this tutorial:� store job just once as durable, triggers are the ones that are changing have a coordinator that handles scheduling, it can have non-running schduler (no .Start() called) with ZeroSizeThreadPool, this coordinator can handle file change events and make sure schedules are synced to DB and thus reflected to actual work horses (schedulers which are


How To Use ASP.NET Core's Windows Service Task Quartz.NET in , Quartz.NET is an amazing scheduler — we can even configure a database To rectify that problem, we can actually save all the scheduler information in a database. be able to see two log files: backupclientlogfile_backupservice.txt and A button that says 'Download on the App Store', and if clicked it. For example, Quartz.Jobs package ships with a pre-made job NativeJo, which will execute any arbitrary native (operating system) system command that it is defined to. Malicious users could use this to take control of, or destroy your system. Likewise other jobs such as SendEmailJob, and virtually any others could be used for malicious intent.


Configuring Quartz.Net with an ADO.Net Job Store (AdoJobStore), Your implementation of the method could look something like this: with all the information we need in order to be able to determine the job's run time. Net. The Quartz.net source code also includes an example of how to do� I am getting the same exception of unable to store the job ,one identifier already exists . I found out a work around for some time ,I used to restart my jboss serevr and the things worked fine for me but now i want the quartz thread to be killed . I wrote a servlet where i scheduled my quartz schedular and wrote load on start up as 0 in my web.xml


Add multiple jobs to the schedule asynchronously � Issue #649 , I am trying to use Quartz.Net and up to now the documentation and examples have helped me get a So you could try setup you job store configuration with: Impl.AdoJobStore. I'll check if there's anything to easily improve here. should save some CPU cycles, but not that much for your use case. A quick note on ADO and DAO -- DAO is native to Access and yes will run faster and more efficiently than ADO -- but DAO only works in Access. ADO is for external data sources (external to Access) which support OLEDB -- that would be Sql Server, Excel, and a few others.