コード例 #1
0
        public void Main(string[] args)
        {
            try
            {
                CancellationTokenSource source = new CancellationTokenSource();

                var startTimerActivityTask = new StartTimerExpiredActivity().Start(source.Token);
                var endTimerActivityTask   = new EndTimerExpiredActivity().Start(source.Token);
                var deciderTask            = new WorkflowDecider().Start(source.Token);

                Logger.LogMessage("All threads start.");

                while (!startTimerActivityTask.IsCanceled && !endTimerActivityTask.IsCanceled && !deciderTask.IsCanceled)
                {
                    Thread.Sleep(5000);
                }
                source.Cancel();
                Logger.LogMessage("Workflow processor exiting.");
            }
            catch (Exception e)
            {
                Logger.LogMessage("Unknown error causing Workflow processor to quit: {0}", Utilities.FormatInnerException(e));
            }
        }
コード例 #2
0
        public void Main(string[] args)
        {
            try
            {
                CancellationTokenSource source = new CancellationTokenSource();

                var startTimerActivityTask = new StartTimerExpiredActivity().Start(source.Token);
                var endTimerActivityTask = new EndTimerExpiredActivity().Start(source.Token);
                var deciderTask = new WorkflowDecider().Start(source.Token);

                Logger.LogMessage("All threads start.");

                while(!startTimerActivityTask.IsCanceled && !endTimerActivityTask.IsCanceled && !deciderTask.IsCanceled)
                {
                    Thread.Sleep(5000);
                }
                source.Cancel();
                Logger.LogMessage("Workflow processor exiting.");
            }
            catch(Exception e)
            {
                Logger.LogMessage("Unknown error causing Workflow processor to quit: {0}", Utilities.FormatInnerException(e));
            }
        }