コード例 #1
0
        // Note how the DataFeedManager service composes other services. The Engine and DataAccessor
        // services are hosted and run "in process" to this DataFeedManager service via
        // the ServiceModelEx InProcFactory. Please see "Programming WCF Services", 3rd Edition
        // by Juval Lowy, pp 71-74 for more information.

        void IDataFeeds.IngestTestData(TestMessage msg)
        {
            DateTime msgReceivedTime = DateTime.Now;

            Debug.Assert(msg != null);

            //string displayMsg = string.Format("{0}.IngestTestData(): Entered:", m_ThisName);
            //ConsoleNTraceHelpers.DisplayInfoToConsoleNTrace(displayMsg);

            // Check validity.
            InProcessFeedMsg    checkedMsg       = null;
            IFeedValidityEngine validityEngProxy = InProcFactory.CreateInstance <ValidityEngine, IFeedValidityEngine>();

            checkedMsg = validityEngProxy.IsTestMessageValid(msg, msgReceivedTime);
            InProcFactory.CloseProxy(validityEngProxy);

            Debug.Assert(checkedMsg != null);
            if (checkedMsg.IsValid)
            {
                // Used only with a test client.
                DisplayMsgAndQueueLength(msg, checkedMsg);

                // Save data.
                IIngestedDataDA ingestDataDaProxy = InProcFactory.CreateInstance <IngestedDataDA, IIngestedDataDA>();
                ingestDataDaProxy.SaveTestData(checkedMsg);
                InProcFactory.CloseProxy(ingestDataDaProxy);
            }
            else
            {
                Debug.Assert(checkedMsg.IsValid);
                LogInvalidMessageError(checkedMsg);
            }
        }
コード例 #2
0
        IngestedDataAnalysisResult ISomeDataAnalysisEngine.DoIngestedDataAnalysis()
        {
            // Get the ingested data from the DB.
            IIngestedDataDA ingestDataDaProxy    = InProcFactory.CreateInstance <IngestedDataDA, IIngestedDataDA>();
            string          dummyDataForAnalysis = ingestDataDaProxy.GetDummyDataForAnalysis();

            // Do the analysis.
            IngestedDataAnalysisResult result = new IngestedDataAnalysisResult();

            InProcFactory.CloseProxy(ingestDataDaProxy);
            result.ResultPart1 = dummyDataForAnalysis;
            int analysisResult = dummyDataForAnalysis.Length;

            result.ResultPart2 =
                string.Format("The analysis of the dummy data reveals it contains {0} characters", analysisResult);
            return(result);
        }