示例#1
0
        public void StartWork()
        {
            Task task = Task.Factory.StartNew(() =>
            {
                MsQueue <LogModel> msQueue = new MsQueue <LogModel>(AppSettings.GetValue("log_msqueue"));
                msQueue.ReceiveMessage(Worker);
            });

            tasks.Add(task);
        }
示例#2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            MsQueue <LogModel> msQueue = new MsQueue <LogModel>(AppSettings.GetValue("log_msqueue"));

            msQueue.CreateQueue();

            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new Service1()
            };
            ServiceBase.Run(ServicesToRun);
        }
        public ActionResult Insert(FileConvertModel fileConvertModel)
        {
            MsQueue <FileConvertModel> convertMsQueue = null;

            if (fileConvertModel.MachineName.IsNullOrEmpty())
            {
                convertMsQueue = new MsQueue <FileConvertModel>(file_msqueue);
            }
            else
            {
                convertMsQueue = new MsQueue <FileConvertModel>(file_remote_msqueue.Replace("{machineName}", fileConvertModel.MachineName));
            }
            convertMsQueue.SendMessage(fileConvertModel, "task");
            return(new ResponseModel <string>(ErrorCode.success, ""));
        }
示例#4
0
        public ActionResult Insert(SchedulingQueueModel schedulingQueueModel)
        {
            MsQueue <SchedulingQueueModel> schedulingQueue = null;

            if (schedulingQueueModel.MachineName.IsNullOrEmpty())
            {
                schedulingQueue = new MsQueue <SchedulingQueueModel>(task_scheduling_msqueue);
            }
            else
            {
                schedulingQueue = new MsQueue <SchedulingQueueModel>(task_scheduling_remote_msqueue.Replace("{machineName}", schedulingQueueModel.MachineName));
            }
            schedulingQueue.SendMessage(schedulingQueueModel, "task_scheduling");
            return(new ResponseModel <string>(ErrorCode.success, ""));
        }
示例#5
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            MsQueue <LogModel> logMsQueue = new MsQueue <LogModel>(AppSettings.GetValue("log_msqueue"));

            logMsQueue.CreateQueue();

            MsQueue <FileConvertModel> fileTaskMsQueue = new MsQueue <FileConvertModel>(AppSettings.GetValue("file_msqueue"));

            fileTaskMsQueue.CreateQueue();

            MsQueue <string> taskSchedulingMsqueue = new MsQueue <string>(AppSettings.GetValue("task_scheduling_msqueue"));

            taskSchedulingMsqueue.CreateQueue();
        }
示例#6
0
        public void StartWork()
        {
            task = Task.Factory.StartNew(() =>
            {
                MsQueue <SchedulingQueueModel> msQueue = new MsQueue <SchedulingQueueModel>(AppSettings.GetValue("task_scheduling_msqueue"));
                msQueue.ReceiveMessage(Worker);
            });

            var schedulings = taskScheduling.GetTaskSchedulings((int)SchedulingStateEnum.Running);

            scheduler.Start();

            foreach (var scheduling in schedulings)
            {
                var dict = GetTriggersAndJobs(scheduling);
                if (dict.Count > 0)
                {
                    scheduler.ScheduleJobs(dict, true);
                }
            }
        }