// SUMMARY: Run task from demand (from signalR) public static void OnDemand(string key) { new System.Threading.Thread(() => { DeamonTaskData task = DeamonTaskData.GetTaskByKey(key); if (task == null) { SignalRConnector.SendMessage(string.Format("OnDemand:: Could not find task with key '{0}'", key)); return; } task.IsOnDemand = true; StartTask(task); }).Start(); }
// SUMMARY: Try to run task public static void StartTask(DeamonTaskData task) { string taskNamespace = task.Namespace; string className = string.Format("{0}.Task, {0}", taskNamespace); DeamonRefactor refactor = new DeamonRefactor(className); if (!refactor.Exists) { Console.WriteLine(DateTime.Now.ToString() + "Task with namespace DOES NOT EXISTS: " + taskNamespace); return; } new System.Threading.Thread(() => { SignalRConnector.SendMessage(DateTime.Now.ToString() + " Task started: " + taskNamespace); refactor.Instantiate(task); }).Start(); }