private bool _innerStart(Ruanal.Core.ApiSdk.TaskDetail taskdetail) { if (taskdetail.TaskType != 1) { throw new Exception("非调度任务,启动失败!"); } lock (dislocker) { if (diswork.Exists(x => x.TaskId == taskdetail.TaskId)) { return(true); } DispatchItem dw = new DispatchItem(taskdetail); bool setOk = this.Schedule.StartJob(taskdetail.TaskId.ToString(), dw, taskdetail.RunCron); if (setOk) { var JobContext = this.Schedule.GetJobContext(taskdetail.TaskId.ToString()); dw.JobContext = JobContext; diswork.Add(dw); return(true); } return(false); } }
public DispatchWork(Ruanal.Core.ApiSdk.TaskDetail taskdetail) { this.TaskDetail = taskdetail; TaskId = this.TaskDetail.TaskId; if (string.IsNullOrEmpty(TaskDetail.DispatchClass)) { _dispatchbase = new EntDispatcher(); TaskVersion = taskdetail.CurrVersionId; } else { _dispatchbase = GetDispatcher(); if (_dispatchbase == null) { throw new Exception("调度器初始化失败!"); } } try { if (!string.IsNullOrWhiteSpace(TaskDetail.TaskConfig)) { _dispatchbase.TaskConfig = RLib.Utils.DataSerialize.DeserializeObject <Dictionary <string, string> >(TaskDetail.TaskConfig); } else { _dispatchbase.TaskConfig = new Dictionary <string, string>(); } } catch (Exception ex) { throw new Exception("任务配置json出错!"); } }
private bool _innerStart(Ruanal.Core.ApiSdk.TaskDetail taskdetail) { lock (servicelocker) { if (serviceItems.Exists(x => x.TaskId == taskdetail.TaskId)) { RLib.WatchLog.Loger.Log("启动任务", "已在运行,无需启动"); return(true); } ServiceDomainItem serviceitem = new ServiceDomainItem(taskdetail); serviceitem.OnWockComplet += DoGetDispatchSign; if (serviceitem.JobType == 0) { bool setOk = this.Schedule.StartJob(taskdetail.TaskId.ToString(), serviceitem, taskdetail.RunCron); if (setOk == false) { RLib.WatchLog.Loger.Log("启动任务", "加入计划失败!"); return(false); } var JobContext = this.Schedule.GetJobContext(taskdetail.TaskId.ToString()); serviceitem.JobContext = JobContext; } serviceItems.Add(serviceitem); RLib.WatchLog.Loger.Log("启动任务", "完成"); return(true); } }
public DispatchItem(Ruanal.Core.ApiSdk.TaskDetail taskdetail) { this.TaskDetail = taskdetail; TaskId = this.TaskDetail.TaskId; _MakeLocalFile(); _GetDispatcher(); _InitDispatch(); }
public ServiceDomainItem(Ruanal.Core.ApiSdk.TaskDetail config) { innerServices = new List <ServiceAndDispatch>(); TaskDetail = config; _MakeLocalFile(); _CreateDomain(); _TestOK(); }
private Ruanal.Core.ApiSdk.TaskDetail LocalTaskToReponse( Model.Task taskmodel, Model.TaskVersion currversion) { var rmodel = new Ruanal.Core.ApiSdk.TaskDetail() { CurrVersionId = taskmodel.CurrVersionId, DispatchClass = taskmodel.DispatchClass, EnterClass = taskmodel.EnterClass, EnterDll = taskmodel.EnterDll, RunCron = taskmodel.RunCron, TaskConfig = taskmodel.TaskConfig, TaskId = taskmodel.TaskId, TaskType = taskmodel.TaskType, Title = taskmodel.Title, FileUrl = currversion.FilePath.Replace("\\", "/") }; return(rmodel); }