Use one windows service to execute jobs and two web applications to schedule jobs

前端 未结 2 1251
名媛妹妹
名媛妹妹 2020-12-11 12:30

I have one SQL Server database as the job store, two web applications that both can schedule jobs, and a Quartz.NET windows service to execute jobs.

I want the two w

相关标签:
2条回答
  • 2020-12-11 12:38

    You probably don't want to instantiate an IScheduler instance in the websites, precisely because creating a local instance also executes jobs.

    I've implemented something similar to what you're looking to do.

    First, make sure that in your service configuration file (app.config) that you configure the four keys quartz.scheduler.exporter.type, quartz.scheduler.exporter.port, quartz.scheduler.exporter.bindName, and quartz.scheduler.exporter.channelType.

    Second, make sure that your web.config has the following four keys configured : quartz.scheduler.instanceName, quartz.scheduler.instanceId, quartz.scheduler.proxy, and quartz.scheduler.proxy.address.

    Then when you create your StdSchedulerFactory() and use it to get a scheduler, you are not instantiating a new scheduler, but attaching to an existing scheduler. You can then do anything through the remote scheduler that you could do with a local one, but there is only a single instance that executes jobs.

    0 讨论(0)
  • 2020-12-11 12:41

    In your config file, set key "quartz.threadPool.type" to "Quartz.Simpl.ZeroSizeThreadPool, Quartz". The quartz scheduler thus created can schedule/modify jobs/trigger/calendars but can not run the jobs.

    0 讨论(0)
提交回复
热议问题