When use AdoJobStore.JobStoreTX jobs not firing
See original GitHub issueVersion: alpha 3.0
Expected behavior
Jobs have to be fired in specified time
Actual behavior
Nothing happens
Steps to reproduce
Scheduler Factory (Singletone):
public class SchedulerFactory : ISchedulerFactory
{
private StdSchedulerFactory _schedulerFactory { get; set; }
private IScheduler _scheduler { get; set; }
public IScheduler Get()
{
if (_scheduler == null)
{
if (_schedulerFactory == null)
{
_schedulerFactory = new StdSchedulerFactory(new NameValueCollection
{
["quartz.scheduler.instanceName"] = "Scheduler",
["quartz.scheduler.instanceId"] = "main",
["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz",
["quartz.threadPool.threadCount"] = "10",
["quartz.threadPool.threadPriority"] = "Normal",
["quartz.jobStore.misfireThreshold"] = "60000",
["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz",
["quartz.jobStore.useProperties"] = "false",
["quartz.jobStore.dataSource"] = "default",
["quartz.jobStore.tablePrefix"] = "QRTZ_",
["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz",
["quartz.jobStore.lockHandler.type"] = "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz",
["quartz.dataSource.default.connectionString"] = "Data Source=.\\SQLEXPRESS;Initial Catalog=QuartzDB;Integrated Security=True;MultipleActiveResultSets=True;",
["quartz.dataSource.default.provider"] = "SqlServer-20",
["quartz.serializer.type"] = "json"
});
}
_scheduler = _schedulerFactory.GetScheduler().Result;
_scheduler.Start().Wait();
}
return _scheduler;
}
public void Dispose()
{
if (!_scheduler?.IsShutdown == true)
_scheduler.Shutdown(false).Wait();
}
}
Simple Job:
public class SendUserEmailsJob : IJob
{
public SendUserEmailsJob()
{
}
public Task Execute(IJobExecutionContext context)
{
return Task.Run(() =>
{
LoggerUtil.Log("fire job", "SCHEDULER");
});
}
}
Adding the job:
var adminEmailsJob = JobBuilder.Create<SendUserEmailsJob>()
.WithIdentity("SendUserEmailsJob")
.Build();
var adminEmailsTrigger = TriggerBuilder.Create()
.WithIdentity("UserEmailsTrigger")
.StartAt(DateTimeOffset.UtcNow.AddDays(-10))
.WithSimpleSchedule(builder => builder.WithIntervalInSeconds(1).RepeatForever().WithMisfireHandlingInstructionFireNow().Build())
.Build();
_scheduler.ScheduleJob(adminEmailsJob, adminEmailsTrigger).Wait();
I’ve created DB with tables. It runs without any errors. Get and save jobs/trigges in DB, but doesn’t want to fire any job with any trigger
If I switch quartz.jobStore.type
to RAMJobStore
everything works fine, but I need to use JobStoreTX
to store all info in one place and get it in other.
What is wrong in my config? Could you help me with it?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
c# - Quartz .net job is not executing
So quartz is not running. IScheduler scheduler = StdSchedulerFactory.GetDefaultScheduler(); scheduler.Start();. After starting it the server ...
Read more >Quartz.NET Configuration Reference
AdoJobStore is used to store scheduling information (job, triggers and calendars) within a relational database. There are actually two separate ...
Read more >Clustered Quartz Scheduler triggers the same job on two ...
I am using Quartz.net to run eight similar jobs once a minute. A windows service runs each Quartz instance and Quartz is set...
Read more >Lesson 9: Job Stores
Lesson 9: Job Stores. JobStore's are responsible for keeping track of all the “work data” that you give to the scheduler: jobs, triggers,...
Read more >Quartz.Net - Job does not wait to finish previous execution ...
When jobs finish as expected, there are no issues at all. Everything works fine, but when I put a delay (Thread.Sleep()) in a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lahma Thank you I didn’t find info how to attach a logger to Quartz. It helped me to find the problem. So some reason sql script (https://github.com/MassTransit/MassTransit-Quartz/blob/master/setup_sql_server.sql) created damaged
QRTZ_FIRED_TRIGGERS
and this bug didn’t allow to fire any job. But when I tried to create the DB and run script again then it started to work as expected. I think it was some glitch ofSqlClient
because I create db and run the script via c# code as initinializator.Small note about logger. Maybe it will be a bit better to add
string.Format
for result of func() :Thank you again! Now everything works perfect!
Here’s an example of getting logs to console using custom log provider. Naturally using a logging library would be more wise.