Exemplo n.º 1
0
        public void Receive(Model.CmdMessage cmdMsg)
        {
            Console.WriteLine(cmdMsg.command);
            var cmd = cmdMsg.command;

            if (cmd == "start")
            {
                this.Start();
            }
            else if (cmd == "reload")
            {
                this.Log().Info("断开连接");
                this.Pause();
                //this.worklistener.Close();
                //this.workThread.Interrupt();
                this.Log().Info("重新初始化服务列表");

                this.Log().Info("重启连接");
                //this.workThread.Start();
                //this.startMessageListener();
                this.Resume();
            }
            else if (cmd == "pause")
            {
                this.Log().Info("暂停");
                this.Pause();
            }
            else if (cmd == "resume")
            {
                this.Log().Info("恢复");
                this.Resume();
            }
            else if (cmd == "init")
            {
                this.Pause();

                var assembly = cmdMsg.Get("task_assembly");
                Loader.Instance.CreateTaskAssembly(assembly, cmdMsg.attachment);

                this.Resume();
            }
        }
Exemplo n.º 2
0
        public void Receive(Model.CmdMessage cmdMsg)
        {
            var cmd = cmdMsg.command;

            if (cmd == "start")
            {
                this.Log().Info("任务开始");
                this.Start();
            }
            else if (cmd == "stop")
            {
                this.Log().Info("任务停止");
                this.running = false;
            }
            else if (cmd == "init")
            {
                this.Log().Info("初始化程序集");

                this.running = false;

                var assembly = cmdMsg.Get("task_assembly");
                Loader.Instance.CreateTaskAssembly(assembly, cmdMsg.attachment);
            }
        }