Example #1
0
        public WorkloadStatisticsDecoratorTask(IDataflowNetworkTask <TInput, TInputMsg, TOutput, TOutputMsg> innerTask, IIdasDataflowNetwork network, ILogAgent logAgent)
            : base(innerTask, network, logAgent)
        {
            var pub = new WorkloadStatisticsZmqPublisher();

            m_ClientSocket = pub.GetPubSocket();
        }
 WithStatistics <TInput, TInputMsg, TOutput, TOutputMsg>
     (this IDataflowNetworkTask <TInput, TInputMsg, TOutput
                                 , TOutputMsg> decoratedSource
     , IIdasDataflowNetwork network
     , ILogAgent logAgent)
     where TInputMsg : IDataflowMessage <TInput>
     where TOutputMsg : IDataflowMessage <TOutput>
 {
     return(new StatisticsLogDecoratorTask <TInput, TInputMsg, TOutput, TOutputMsg>(decoratedSource, network, logAgent));
 }
Example #3
0
        public DataflowNetworkDecoratorTask(IDataflowNetworkTask <TInput, TInputMsg, TOutput, TOutputMsg> innerTask, IIdasDataflowNetwork network, ILogAgent logAgent)
        {
            if (innerTask == null)
            {
                throw new ArgumentNullException("innerTask", "Inner task must not be null!");
            }

            m_InnerTask = innerTask;
            m_LogAgent  = logAgent;
            m_Network   = network;
        }
        /// <summary>
        /// Creates a transformation that takes one input and produces one output for each.
        /// </summary>
        /// <typeparam name="TInput"></typeparam>
        /// <typeparam name="TOutput"></typeparam>
        /// <param name="transformation"></param>
        /// <param name="boundedCapacity"></param>
        /// <returns></returns>
        public virtual TransformationBlock <TInput, TInputMsg, TOutput, TOutputMsg> TransformationFor <TInput, TInputMsg, TOutput, TOutputMsg>(
            IDataflowNetworkTask <TInput, TInputMsg, TOutput, TOutputMsg> transformation
            )
            where TOutputMsg : IDataflowMessage <TOutput>
            where TInputMsg : IDataflowMessage <TInput>
        {
            var task = DecorateTaskWithDefaults(transformation);

            var options = CreateDefaultExecutionBlockOptions();

            var block = new TransformationBlock <TInput, TInputMsg, TOutput, TOutputMsg>(this, task, options);

            m_CreatedBlocks.Add(block);

            return(block);
        }
 public SourceBlock(IIdasDataflowNetwork network, IDataflowNetworkTask <TOut, TMsg, TOut, TMsg> source)
     : base(network, null, null)
 {
     m_Source = source;
 }
 public SourceBlock(IIdasDataflowNetwork network, ExecutionDataflowBlockOptions options, IDataflowNetworkTask <TOut, TMsg, TOut, TMsg> source)
     : base(network, null, options)
 {
     m_Source = source;
 }
 public LoggingDecoratorTask(IDataflowNetworkTask <TInput, TInputMsg, TOutput, TOutputMsg> innerTask, IIdasDataflowNetwork network, ILogAgent logAgent)
     : base(innerTask, network, logAgent)
 {
 }
Example #8
0
 public FinalizerTargetBlock(IIdasDataflowNetwork network, IDataflowNetworkTask <TIn, TInMsg, TIn, TInMsg> action, ExecutionDataflowBlockOptions blockOptions)
     : base(network, action, blockOptions)
 {
 }
Example #9
0
 public TargetBlock(IIdasDataflowNetwork network, IDataflowNetworkTask <TIn, TInMsg, TIn, TInMsg> action, ExecutionDataflowBlockOptions blockOptions)
     : base(network, null, blockOptions)
 {
     m_Action = action;
 }
Example #10
0
 public static IDataflowNetworkTask <TInput, TInputMsg, TOutput, TOutputMsg> SkipEmpty <TInput, TInputMsg, TOutput, TOutputMsg>(this IDataflowNetworkTask <TInput, TInputMsg, TOutput, TOutputMsg> decoratedSource, IIdasDataflowNetwork network, ILogAgent logAgent)
     where TInputMsg : IDataflowMessage <TInput>
     where TOutputMsg : IDataflowMessage <TOutput>
 {
     return(new SkipEmptyMessagesDecoratorTask <TInput, TInputMsg, TOutput, TOutputMsg>(decoratedSource, network, logAgent));
 }
Example #11
0
 public SkipEmptyMessagesDecoratorTask(IDataflowNetworkTask <TInput, TInputMsg, TOutput, TOutputMsg> innerTask, IIdasDataflowNetwork network, ILogAgent logAgent)
     : base(innerTask, network, logAgent)
 {
 }
 public TransformationBlock(IIdasDataflowNetwork network, IDataflowNetworkTask <TIn, TInMsg, TOut, TOutMsg> transformation, ExecutionDataflowBlockOptions blockOptions)
     : base(network, null, blockOptions)
 {
     m_Transformation = transformation;
 }
        protected virtual IDataflowNetworkTask <TInput, TInputMsg, TOutput, TOutputMsg> DecorateTaskWithDefaults <TInput, TInputMsg, TOutput, TOutputMsg>(IDataflowNetworkTask <TInput, TInputMsg, TOutput, TOutputMsg> task)
            where TOutputMsg : IDataflowMessage <TOutput>
            where TInputMsg : IDataflowMessage <TInput>
        {
            task = task
                   .WithExceptionHandler(this, m_LogAgent)
                   .SkipEmpty(this, m_LogAgent)
                   .WithLogging(this, m_LogAgent);

            if (m_LogStatistics)
            {
                var withStatisticsTask = task.WithStatistics(this, m_LogAgent);
                m_StatisticsLoggers.Add(withStatisticsTask);
                task = withStatisticsTask;
            }

            //Finallly make sure not to pass the broken messages to the next task...
            task = task.SkipBroken(this, m_LogAgent);

            return(task);
        }
        public virtual SourceBlock <TOutput, TOutputMsg> SourceFor <TOutput, TOutputMsg>(IDataflowNetworkTask <TOutput, TOutputMsg, TOutput, TOutputMsg> source)
            where TOutputMsg : IDataflowMessage <TOutput>
        {
            var task = DecorateTaskWithDefaults(source);

            var options = CreateDefaultExecutionBlockOptions();

            var block = new SourceBlock <TOutput, TOutputMsg>(this, options, task);

            m_CreatedBlocks.Add(block);

            return(block);
        }
Example #15
0
 public static IDataflowNetworkTask <TInput, TInputMsg, TOutput, TOutputMsg> WithExceptionHandler <TInput, TInputMsg, TOutput, TOutputMsg>(this IDataflowNetworkTask <TInput, TInputMsg, TOutput, TOutputMsg> decoratedSource, IIdasDataflowNetwork network, ILogAgent logAgent)
     where TInputMsg : IDataflowMessage <TInput>
     where TOutputMsg : IDataflowMessage <TOutput>
 {
     return(new ExceptionDecoratorTask <TInput, TInputMsg, TOutput, TOutputMsg>(decoratedSource, network, logAgent));
 }