コード例 #1
0
        private async Task <ServiceStatus> AppraiseThings(
            IDictionary <Type, BufferBlock <BasicInfo> > rawDataQueues,
            IList <BufferBlock <RatingDataContainer> > appraisedDataQueues)
        {
            try
            {
                bool status = await AppraisersManagerAsync.GetAllRatings(
                    rawDataQueues, appraisedDataQueues, _dataFlowOptions
                    );

                if (status)
                {
                    GlobalMessageHandler.OutputMessage(
                        "Appraisers have calculated ratings successfully."
                        );
                    return(ServiceStatus.Ok);
                }

                GlobalMessageHandler.OutputMessage(
                    "Appraisers have not calculated ratings. Result is empty."
                    );
                return(ServiceStatus.Nothing);
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "Exception occured during appraising work.");
                return(ServiceStatus.AppraiseError);
            }
        }
コード例 #2
0
ファイル: ShellAsync.cs プロジェクト: Vasar007/ProjectV
        private DataflowPipeline ConstructPipeline(string storageName)
        {
            // Input component work.
            InputtersFlow inputtersFlow = InputManagerAsync.CreateFlow(storageName);

            // Crawlers component work.
            CrawlersFlow crawlersFlow = CrawlersManagerAsync.CreateFlow();

            // Appraisers component work.
            AppraisersFlow appraisersFlow = AppraisersManagerAsync.CreateFlow();

            // Output component work.
            OutputtersFlow outputtersFlow =
                OutputManagerAsync.CreateFlow(storageName: string.Empty);

            // Constructing pipeline.
            inputtersFlow.LinkTo(crawlersFlow);
            crawlersFlow.LinkTo(appraisersFlow);
            appraisersFlow.LinkTo(outputtersFlow);

            return(new DataflowPipeline(inputtersFlow, outputtersFlow));
        }