Second run of Quartz fails when using persistent store
Grammarian opened this issue · 1 comments
Grammarian commented
If I modify the SilkierQuartz.Example
to use job persistence, it runs fine the first time.
But when I run it the second time, it throws this exception:
Unhandled exception. Quartz.JobPersistenceException: Couldn't store job: Unable to store Job: 'DEFAULT.HelloJobAuto', because one already exists with this identification.
---> Quartz.ObjectAlreadyExistsException: Unable to store Job: 'DEFAULT.HelloJobAuto', because one already exists with this identification.
at Quartz.Impl.AdoJobStore.JobStoreSupport.StoreJob(ConnectionAndTransactionHolder conn, IJobDetail newJob, Boolean replaceExisting, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at Quartz.Impl.AdoJobStore.JobStoreSupport.StoreJob(ConnectionAndTransactionHolder conn, IJobDetail newJob, Boolean replaceExisting, CancellationToken cancellationToken)
at Quartz.Impl.AdoJobStore.JobStoreSupport.<>c__DisplayClass152_0.<<StoreJobAndTrigger>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Quartz.Impl.AdoJobStore.JobStoreSupport.ExecuteInNonManagedTXLock[T](String lockName, Func`2 txCallback, Func`3 txValidator, Nullable`1 requestorId, CancellationToken cancellationToken)
at Quartz.Impl.AdoJobStore.JobStoreSupport.ExecuteInNonManagedTXLock[T](String lockName, Func`2 txCallback, Func`3 txValidator, Nullable`1 requestorId, CancellationToken cancellationToken)
at Quartz.Impl.AdoJobStore.JobStoreSupport.StoreJobAndTrigger(IJobDetail newJob, IOperableTrigger newTrigger, CancellationToken cancellationToken)
at Quartz.Core.QuartzScheduler.ScheduleJob(IJobDetail jobDetail, ITrigger trigger, CancellationToken cancellationToken)
at SilkierQuartz.HostedService.QuartzHostedService.StartAsync(CancellationToken cancellationToken) in C:\src\GitHub\SilkierQuartz\src\SilkierQuartz\HostedService\QuartzHostedService.cs:line 50
This is the quartz section after I modified app.config
:
<quartz>
<add key="quartz.plugin.recentHistory.type" value="Quartz.Plugins.RecentHistory.ExecutionHistoryPlugin, Quartz.Plugins.RecentHistory" />
<add key="quartz.plugin.recentHistory.storeType" value="Quartz.Plugins.RecentHistory.Impl.InProcExecutionHistoryStore, Quartz.Plugins.RecentHistory" />
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.useProperties" value="true" />
<add key="quartz.jobStore.dataSource" value="default" />
<add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
<add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />
<add key="quartz.dataSource.default.connectionString" value="Server=localhost; Database=MyTestDb;Integrated Security=true;"/>
<add key="quartz.dataSource.default.provider" value="SqlServer" />
<add key="quartz.serializer.type" value="json" />
</quartz>
I'd like to be able to run Quartz more than once :)
maikebing commented
Well, it's a mistake.