Example #1
0
        /// <summary>
        /// Processes the work item.
        /// </summary>
        /// <param name="message">The message.</param>
        protected override void ProcessMessage(PipeMessageEnvelope message)
        {
            try
            {
                _parserResponse = (LoadFileRecordCollection)message.Body;

                #region Dataset Detaills

                if (_dataset == null)
                {
                    _dataset = _parserResponse.dataset;
                    if (_dataset != null && !string.IsNullOrEmpty(_dataset.CompressedFileExtractionLocation))
                    {
                        _datasetPath = _dataset.CompressedFileExtractionLocation;
                    }
                }
                if (String.IsNullOrEmpty(_uniqueThreadString))
                {
                    _uniqueThreadString = _parserResponse.UniqueThreadString;
                }

                #endregion

                ParseRecordText();
            }
            catch (Exception ex)
            {
                ReportToDirector(ex);
                ex.Trace().Swallow();
                LogMessage(false, ex.ToUserString());
            }
        }
        /// <summary>
        /// Send Worker response to Pipe.
        /// </summary>
        /// <param name="recordList"></param>
        private void Send(List <LoadFileRecord> recordList)
        {
            // In case of append, assign the dcn for the documents here
            if (m_Parameters.IsAppend)
            {
                // Assign DCN
                AssignDocumentControlNumber(recordList);
            }

            var recordCollection = new LoadFileRecordCollection
            {
                Records            = recordList,
                dataset            = m_Dataset,
                UniqueThreadString = _uniqueThreadString
            };

            OutputDataPipe.ShouldNotBe(null);
            var message = new PipeMessageEnvelope
            {
                Body = recordCollection
            };

            OutputDataPipe.Send(message);
            IncreaseProcessedDocumentsCount(recordList.Count);
        }