Nanoko/quartznet-mongodb

JobKey is always null

Closed this issue · 3 comments

When trying to run this code, it always fails because JobKey is null.

I've checked the DB and its writing the trigger correctly.

        NameValueCollection properties = new NameValueCollection();
        properties["quartz.scheduler.instanceName"] = "MyApplicationScheduler"; // needed if you plan to use the same database for many schedulers
        properties["quartz.scheduler.instanceId"] = System.Environment.MachineName + DateTime.UtcNow.Ticks; // requires uniqueness
        properties["quartz.jobStore.type"] = "Quartz.Impl.MongoDB.JobStore, Quartz.Impl.MongoDB";
        ISchedulerFactory schedulerFactory = new StdSchedulerFactory(properties);
        IScheduler scheduler = schedulerFactory.GetScheduler();
        scheduler.Start();
        IJobDetail job = JobBuilder.Create(typeof(SimpleJob)).WithIdentity("MyJob19", "MyJobGroup").Build();
        ITrigger trigger = TriggerBuilder.Create().WithSchedule(SimpleScheduleBuilder.RepeatSecondlyForTotalCount(10)).StartNow().WithIdentity("MyJobTrigger", "MyJobTriggerGroup").Build();
        scheduler.ScheduleJob(job, trigger);
        Console.ReadKey();
        scheduler.Shutdown(true)

This seems to be related to mongodb driver 1.8.1. Once I rolled back to the 1.7.1 driver this error went away.

Any ideas on how to fix for 1.8.1?

I've sent a pull request #13 that fixes this for 1.8.1