public static OutOfProcessReportGenerationController CreateController(
     IOutOfProcessConfiguration configuration,
     IProcessFactory processFactory,
     IReportQueueStatusService statusService)
 {
     var controller = new OutOfProcessReportGenerationController(configuration, processFactory,
         statusService);
     controller.RunProcess = true;
     controller.DatabaseQueuePollInterval = 500;
     return controller;
 }
Exemplo n.º 2
0
        /// <summary>
        /// The OnStart Event
        /// </summary>
        /// <param name="args">The arguments</param>
        protected override void OnStart(string[] args)
        {
            try
            {
                // Report Generation Controlle
                this._ReportGenerationController = OutOfProcessControllerFactory.Create();

                this._ReportGenerationController.RunProcess = true;
                this._ReportGenerationControllerThread = new System.Threading.Thread(this._ReportGenerationController.Run);
                this._ReportGenerationControllerThread.Start();
            }
            catch (Exception exception)
            {
                AdaptableErrorHandler.AdaptableErrorHandlerInstance.HandleError("Application", "GRP.MainController", exception);
            }
        }
Exemplo n.º 3
0
        public void TestMethod1()
        {
            Thread _ReportGeneratorThread = null;

            OutOfProcessReportGenerationController _ReportGenerator = null;

            //TimeLine
            _ReportGenerator = new OutOfProcessReportGenerationController(this.ErrorHandler);
            _ReportGenerator.RunProcess = true;
            _ReportGeneratorThread = new System.Threading.Thread(_ReportGenerator.Run);
            _ReportGeneratorThread.Start();

            while (_ReportGeneratorThread.ThreadState == ThreadState.Running ||
                _ReportGeneratorThread.ThreadState == ThreadState.WaitSleepJoin)
            {
                System.Threading.Thread.Sleep(1000);
            }
        }
Exemplo n.º 4
0
        public static void MonitorController(OutOfProcessReportGenerationController controller, int monitorQueueId)
        {
            controller.RunProcess = true;
            IHostedProcess runningProcess = null;

            ProcessStartedEvent handler = (sender, args) =>
            {
                if (args.Process.ReportGenerationQueueId == monitorQueueId)
                {
                    runningProcess = args.Process;
                }
            };

            controller.OnProcessStarted += handler;

            var lastTick = DateTime.Now.Ticks;
            Thread monitor = new Thread(new ThreadStart(() =>
            {
                try
                {
                    while (runningProcess == null || !runningProcess.HasExited)
                    {
                        TimeOutHelper.TimeOutCheck(lastTick, 60);
                        Thread.Sleep(10);
                    }
                    controller.RunProcess = false;
                }
                catch (Exception e)
                {
                    Console.WriteLine("Fatal thread exception: " + e.Message);
                }
            }));
            monitor.Start();

            controller.Run();

            controller.OnProcessStarted -= handler;
        }