private void ReportStateChange()
        {
            WorkerStateChangedMessage message = new WorkerStateChangedMessage(WorkAssignment, State);
            var envelope = new PipeMessageEnvelope()
            {
                Body  = message,
                Label = WorkerStateChangedMessage.MessageLabel,
            };

            ReportPipe.Send(envelope);
        }
        public void ReportToDirector(string message)
        {
            WorkerMessage workerMessage = new WorkerMessage(WorkerId, message);
            var           envelope      = new PipeMessageEnvelope()
            {
                Body  = workerMessage,
                Label = WorkerMessage.MessageLabel,
            };

            if (null != ReportPipe)
            {
                ReportPipe.Send(envelope);
            }
        }
Пример #3
0
        public void Delete()
        {
            if (ReportPipe != null)
            {
                ReportPipe.Delete();
            }

            foreach (PipelineSection pipelineSection in PipelineSections)
            {
                pipelineSection.DeletePipes();
            }

            // Just in case
            PipelineSections.Clear();
        }
        public void ForceSend()
        {
            WorkTimeNet   = _workTimeNet.Elapsed;
            WorkTimeGross = _workTimeGross.Elapsed - _idleTime;

            var envelope = new PipeMessageEnvelope()
            {
                Body  = this,
                Label = MessageLabel,
            };

            ReportPipe.Send(envelope);
            PreviousHeartBeatSentTime = DateTime.Now;
            _dirty = false;
        }
Пример #5
0
        // This is separate thread!
        public void Run()
        {
            try
            {
                PipelineStatus.PipelineState = PipelineState.Running;
                _runTime.Start();
                _timeSinceTheLastProgressReport.Start();
                bool continueMessagePumping;
                do
                {
                    PipeMessageEnvelope envelope = ReportPipe.Receive(_reportPipeTimeout);
                    lock (this)
                    {
                        UpdatePipelineState(envelope, out continueMessagePumping);
                    }
                } while (continueMessagePumping);

                ForceReportPipelineStatus("FINAL PIPELINE STATUS: ", true);
            }
            catch (Exception ex)
            {
                ex.Trace();
            }
        }