public ExceptionDecoratorTransformationBatched(ITransformationBatched <TIn, TOut> decoratedTransformation, ILogAgent logAgent, ICancelNetwork cancel) { m_DecoratedTransformation = decoratedTransformation; m_LogAgent = logAgent; m_Cancel = cancel; }
/// <summary> /// Creates a transformation that takes one batched input and produces one output for. /// </summary> /// <typeparam name="TIn"></typeparam> /// <typeparam name="TOut"></typeparam> /// <param name="transformation"></param> /// <param name="boundedCapacity"></param> /// <returns></returns> public TransformBlock <IDataflowMessage <TIn>[], IDataflowMessage <TOut> > CreateTransformBatched <TIn, TOut>(ITransformationBatched <TIn, TOut> transformation, int boundedCapacity = -1) { TransformBlock <IDataflowMessage <TIn>[], IDataflowMessage <TOut> > block = null; var transFunc = transformation .WithExceptionHandler(m_LogAgent, this) .WithLogging(m_LogAgent) .WithWorkloadStatistics(boundedCapacity, () => block.InputCount, () => block.OutputCount, m_ctx, this.m_DfnGuid, m_Cts.Token); if (m_LogStatistics) { transFunc = transFunc.WithStatistics(m_LogAgent); m_StatisticsLoggers.Add((IStatisticsLogger)transFunc); } block = new TransformBlock <IDataflowMessage <TIn>[], IDataflowMessage <TOut> >( transFunc .AsFunction(), CreateDefaultExecutionOptions(boundedCapacity)); return(block); }
public static ITransformationBatchedFunctor <TIn, TOut> WithExceptionHandler <TIn, TOut>(this ITransformationBatched <TIn, TOut> decoratedTransformation, ILogAgent log, ICancelNetwork cancel) { return(new ExceptionDecoratorTransformationBatched <TIn, TOut>(decoratedTransformation, log, cancel)); }