1

我目前工作Quartz.NET(2.3.1版本)来控制石英调度。我创建了不同的调度程序使用下面的代码(每个调度)不同的工作:从外部应用程序

NameValueCollection properties = new NameValueCollection(); 
properties["quartz.scheduler.instanceName"] = "QuartzSchedulerTest"; 
properties["quartz.scheduler.instanceId"] = AUTO; 
properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz"; 
properties["quartz.threadPool.threadPriority"] = "Normal"; 
properties["quartz.jobStore.misfireThreshold"] = "60000"; 
properties["quartz.jobStore.clustered"] = "true"; 
properties["quartz.jobStore.tablePrefix"] = "QRTZ_"; 
properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz"; 
properties["quartz.jobStore.dataSource"] = "default"; 
properties["quartz.jobStore.useProperties"] = "false"; 
properties["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz"; 
properties["quartz.dataSource.default.connectionString"] = "myConnString" 
properties["quartz.dataSource.default.provider"] = "SqlServer-20"; 

// Get scheduler 
ISchedulerFactory sf = new StdSchedulerFactory(properties); 
IScheduler scheduler = sf.GetScheduler(); 

现在我已经存储在SQL数据库上的所有调度信息和一切正常。

我创建了一个新的控制台应用程序,因为我需要管理所有调度(获得调度列表,每个调度工作,发送命令暂停和恢复触发ECC ...)。 这是我写的尝试有处理程序,所有现有的调度代码:

NameValueCollection properties = new NameValueCollection(); 
properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz"; 
properties["quartz.threadPool.threadPriority"] = "Normal"; 
properties["quartz.jobStore.misfireThreshold"] = "60000"; 
properties["quartz.jobStore.clustered"] = "true"; 
properties["quartz.jobStore.tablePrefix"] = "QRTZ_"; 
properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz"; 
properties["quartz.jobStore.dataSource"] = "default"; 
properties["quartz.jobStore.useProperties"] = "false"; 
properties["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz"; 
properties["quartz.dataSource.default.connectionString"] = "myConnString" 
properties["quartz.dataSource.default.provider"] = "SqlServer-20"; 

// Get scheduler 
ISchedulerFactory sf = new StdSchedulerFactory(properties); 
var schedulers = sf.AllSchedulers; 

但没有处理程序返回(调度数为0)。任何人都可以告诉我如何获得所有调度程序?可能吗?

对不起,我提前英语和感谢。

+0

您需要访问调度[远程](http://stackoverflow.com/questions/26480787/get-an-instance-of-the-scheduler-that-is-being-run-on-a-windows -service/26482361#26482361) – 2015-03-25 11:01:50

回答

0

您必须连接到每个调度实例直接使用远程处理。调度程序不知道对方,也无法获取集群中所有调度程序的列表。

一旦你连接到每个调度,那么你就可以拉运行的作业清单和操作作业计划是必要的。如果所有调度程序都在一个集群中,那么您不必连接所有这些调度程序来自己操作作业。你可以从任何实例中做到这一点。但是,正在运行的作业列表必须通过单独询问每个调度程序进行编译。

相关问题