Is it possible to add job with trigger for running Quartz.NET scheduler instance without restarting server?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
A fairly robust implementation with ADOJobStore is to have a custom table to store jobs and create a class that inherits from ISchedulerPlugin and IJob to create schedules for your job automatically.
Your config will look like this:
Your plugin/job class can look like this:
Now JobSchedulerPlugin has entered a trigger into QRTZ_TRIGGERS that will fire every five minutes with highest priority. You can use it to load jobs from your custom table (let's call it QUARTZJOBS). QUARTZJOBS can contain information such as jobnames, assembly paths, dates, status, etc, anything that can be used to help you create triggers efficiently. It should also contain the cron expression to the job. This is what you can do when the trigger fires:
In each of the classes above you can add custom validation for making sure triggers are handled appropriately if status or cron expression changes.
With this solution the server will never need to be restarted. The plugin/job class will scan the table and act accordingly.
What is your data store?
Here is one scenario... a little off the beaten path:
You can write a small console app (or similar) that is the "Job Populater".
You can wire it to pull job definitions from an xml file, and push them into ADO datastore (sql server).
Here is my quartz config to do this:
Which (as you see in the comments in the xml), I got help with.
Here is the original : RAMJobStore (quartz_jobs.xml) to AdoJobStore Data Move