Exemplo n.º 1
0
        public void UpdateServiceStatus(QueueControllerStatus status)
        {
            if (status == null)
            {
                Clients.Caller.updateServiceStatus(null);
                return;
            }

            var controller = GlobalService.Controller;

            controller.WaitInterval = status.waitInterval;
            controller.QueueName    = status.queueName;
            controller.ThreadCount  = status.threadCount;

            if (controller.ThreadCount > 20)
            {
                controller.ThreadCount = 20;
                status.threadCount     = 20;
            }

            var config = QueueMessageManagerConfiguration.Current;

            config.ControllerThreads = controller.ThreadCount;
            config.WaitInterval      = controller.WaitInterval;
            config.QueueName         = status.queueName;

            // try to save config settings
            config.Write();

            controller.StopProcessing();
            //Thread.Sleep(1000);
            controller.StartProcessingAsync();

            // update all clients with the status information
            Clients.All.updateServiceStatusCallback(status);

            StatusMessage("Service Status settings updated.", true);
        }
        public void UpdateServiceStatus(QueueControllerStatus status)
        {                     

            if (status == null)
            {
                Clients.Caller.updateServiceStatus(null);
                return;
            }

            var controller = GlobalService.Controller;
            controller.WaitInterval = status.waitInterval;
            controller.QueueName = status.queueName;
            controller.ThreadCount = status.threadCount;            
            
            if (controller.ThreadCount > 20)
            {
                controller.ThreadCount = 20;
                status.threadCount = 20;
            }

            var config = QueueMessageManagerConfiguration.Current;
            config.ControllerThreads = controller.ThreadCount;
            config.WaitInterval = controller.WaitInterval;
            config.QueueName = status.queueName;
            
            // try to save config settings
            config.Write();            

            controller.StopProcessing();
            //Thread.Sleep(1000);            
            controller.StartProcessingAsync();
            
            // update all clients with the status information
            Clients.All.updateServiceStatusCallback(status);

            StatusMessage("Service Status settings updated.",true);
        }