Exemple #1
0
        //------------------------------------------------
        // 主入口
        //------------------------------------------------
        static void Main(string[] args)
        {
            // 确保只有一个程序在运行
            if (AreadyExistInstance())
            {
                Console.WriteLine("本程序已有一个实例在运行。");
                return;
            }

            // 设置关闭事件
            //SetConsoleCtrlHandler(new AppQuitDelegate(AppQuit), true);

            // 开启任务引擎
            var version = Assembly.GetExecutingAssembly().GetName().Version;
            var folder  = new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName;

            Console.WriteLine("App.Schedule consoler {0}", version);
            string configFile = string.Format("{0}\\schedule.config", folder);

            engine = new ScheduleEngine(configFile);
            engine.ConfigFailure += (info) => Logger.Error("{0}", info);
            //engine.ConfigSave += (cfg) => cfg.Save();
            engine.TaskSuccess += (task, info) => Logger.Info("{0} {1} ok", task.Name, task.Data);
            engine.TaskFailure += (task, info) => Logger.Warn("{0} {1} fail, times={2}, info={3}", task.Name, task.Data, task.Failure.TryTimes, info);
            engine.Start();
        }
 public void Start()
 {
     m_logger.Trace("Starting Scheduler Service");
     OwinService.Instance.Start();
     JobEngine.Instance.Start();
     m_scheduleEngine.Start();
 }
Exemple #3
0
        public static bool StartServices()
        {
            MessageQueueService.StartService();

            NetworkService.StartService();

            ScheduleEngine.Start();
            logger.Info("Schedule engine started.");

            return(true);
        }