public ResourceEnricherBlock(CancellationToken cancellationToken, IResourceEnricher resourceEnricher, ILog log) : base(cancellationToken, maxDegreeOfParallelism: 300) { _log = log; _resourceEnricher = resourceEnricher; var generalDataflowBlockOptions = new DataflowBlockOptions { CancellationToken = cancellationToken }; FailedProcessingResults = new BufferBlock <FailedProcessingResult>(generalDataflowBlockOptions); base.Completion.ContinueWith(_ => { FailedProcessingResults.Complete(); }); }
public BrokenLinkCollectionWorkflow(CancellationToken cancellationToken, Configurations configurations, IStatistics statistics, IHardwareMonitor hardwareMonitor, IResourceExtractor resourceExtractor, IReportWriter reportWriter, ILog log, IResourceEnricher resourceEnricher, IResourceVerifier resourceVerifier, Func <IHtmlRenderer> getHtmlRenderer) { _log = log; _coordinatorBlock = new CoordinatorBlock(cancellationToken, log); _eventBroadcasterBlock = new EventBroadcasterBlock(cancellationToken); _processingResultGeneratorBlock = new ProcessingResultGeneratorBlock(cancellationToken, resourceExtractor, log); _reportWriterBlock = new ReportWriterBlock(cancellationToken, reportWriter, log); _resourceEnricherBlock = new ResourceEnricherBlock(cancellationToken, resourceEnricher, log); _resourceVerifierBlock = new ResourceVerifierBlock(cancellationToken, statistics, resourceVerifier, log); _htmlRendererBlock = new HtmlRendererBlock( cancellationToken, statistics, log, configurations, hardwareMonitor, getHtmlRenderer ); WireUpBlocks(); void WireUpBlocks() { var generalDataflowLinkOptions = new DataflowLinkOptions { PropagateCompletion = true }; _coordinatorBlock.LinkTo(NullTarget <Resource>(), PropagateNullObjectsOnly <Resource>()); _coordinatorBlock.LinkTo(_resourceEnricherBlock, generalDataflowLinkOptions); _resourceEnricherBlock.LinkTo(NullTarget <Resource>(), PropagateNullObjectsOnly <Resource>()); _resourceEnricherBlock.LinkTo(_resourceVerifierBlock, generalDataflowLinkOptions); _resourceEnricherBlock.FailedProcessingResults.LinkTo(_coordinatorBlock); _resourceVerifierBlock.LinkTo(NullTarget <Resource>(), PropagateNullObjectsOnly <Resource>()); _resourceVerifierBlock.LinkTo(_htmlRendererBlock, generalDataflowLinkOptions); _resourceVerifierBlock.FailedProcessingResults.LinkTo(_coordinatorBlock); _resourceVerifierBlock.VerificationResults.LinkTo(_reportWriterBlock); _resourceVerifierBlock.Events.LinkTo(_eventBroadcasterBlock); _htmlRendererBlock.LinkTo(NullTarget <RenderingResult>(), PropagateNullObjectsOnly <RenderingResult>()); _htmlRendererBlock.LinkTo(_processingResultGeneratorBlock, generalDataflowLinkOptions); _htmlRendererBlock.VerificationResults.LinkTo(_reportWriterBlock, generalDataflowLinkOptions); _htmlRendererBlock.FailedProcessingResults.LinkTo(_coordinatorBlock); _htmlRendererBlock.Events.LinkTo(_eventBroadcasterBlock, generalDataflowLinkOptions); _processingResultGeneratorBlock.LinkTo(NullTarget <ProcessingResult>(), PropagateNullObjectsOnly <ProcessingResult>()); _processingResultGeneratorBlock.LinkTo(_coordinatorBlock); _eventBroadcasterBlock.LinkTo(NullTarget <Event>(), PropagateNullObjectsOnly <Event>()); Predicate <T> PropagateNullObjectsOnly <T>() { return(@object => @object == null); } ITargetBlock <T> NullTarget <T>() { return(DataflowBlock.NullTarget <T>()); } } }