What is the configuration method of Quartz.NET remote scheduling
This article introduces the relevant knowledge of "what is the configuration method of Quartz.NET remote scheduling". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Configure Quartz.NET remote execution
Configure the exit of the remote call Quartz on the server where the task is scheduled, and add the following configuration to quartz.config
# export this server to remoting context quartz.scheduler.exporter.type = Quartz.Simpl.RemotingSchedulerExporter, Quartz quartz.scheduler.exporter.port = 555 quartz.scheduler.exporter.bindName = QuartzScheduler quartz.scheduler.exporter.channelType = tcp quartz.scheduler.exporter.channelName = httpQuartz
1. The address of the client's "quartz.scheduler.proxy.address" configuration consists of channelType,port and bindName configured on the server. Pay attention to consistency.
two。 When the server initializes and starts, the process of launching the relevant Job from the database is not detailed here. Next time I introduce my own task scheduling platform, I will talk about it in more detail.
3. On the Job server, even a service host controls and schedules all job execution plans in the background.
two。 Manage client
A) create a background managed client, which can be a web website. It could be something else.
Initialize all Scheduler on the remote server
Private static IScheduler scheduler = null; public static void InitRemoteScheduler () {try {NameValueCollection properties = new NameValueCollection (); properties ["quartz.scheduler.instanceName"] = "schedMaintenanceService"; properties ["quartz.scheduler.proxy"] = "true" Properties ["quartz.scheduler.proxy.address"] = string.Format ("{0}: / / {1}: {2} / QuartzScheduler", scheme, server, port); ISchedulerFactory sf = new StdSchedulerFactory (properties)
Scheduler = sf.GetScheduler ();} catch (Exception ex) {LogHelper.WriteLog ("failed to initialize remote task manager" + ex.StackTrace);}}
B) add, pause, delete, etc.
/ / suspend the task / public static void PauseJob (string JobKey) {try {JobKey jk = new JobKey (JobKey); if (scheduler.CheckExists (jk)) {/ / suspend the task scheduler.PauseJob (jk) if the task already exists LogHelper.WriteLog (string.Format ("Task" {0} "paused", JobKey));} catch (Exception ex) {throw ex;}} "what is the configuration method of Quartz.NET remote scheduling"? thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!