public IDataflowMessage <TOut> Transform(IDataflowMessage <TIn> item)
        {
            Interlocked.Increment(ref m_NumMessagesProcessed);
            if (item.IsBroken)
            {
                m_LogAgent.LogTrace(DataflowNetworkConstituent.Transformation, Title, "Broken message propagates through network. Node: {0}, Message: {1}", Title, item.Title);
            }
            else
            {
                m_LogAgent.LogTrace(DataflowNetworkConstituent.Transformation, m_DecoratedTransformation.Title, "Transforming: {0}", item.Title);
            }

            IDataflowMessage <TOut> result = m_DecoratedTransformation.Transform(item);

            if (result.IsBroken)
            {
                Interlocked.Increment(ref m_NumBrokenMsgs);
                m_LogAgent.LogBrokenMessage(DataflowNetworkConstituent.Transformation, Title, result.Title, (IBrokenDataFlowMessage <TOut>)result);
            }
            else
            {
                m_LogAgent.LogTrace(DataflowNetworkConstituent.Transformation, m_DecoratedTransformation.Title, "Transformed: old: {0} new: {1}", item.Title, result.Title);
            }
            return(result);
        }
Exemple #2
0
        public IEnumerable <IDataflowMessage <TOut> > TransformMany(IDataflowMessage <TIn> item)
        {
            m_LogAgent.LogTrace(DataflowNetworkConstituent.TransformMany, m_Decorated.Title, "Transforming: {0}", item.Title);
            var result = m_Decorated.TransformMany(item);

            m_LogAgent.LogTrace(DataflowNetworkConstituent.TransformMany, m_Decorated.Title, "Transformed: {0}", item.Title);
            return(result);
        }
 public void Push(IDataflowMessage <TIn> item)
 {
     if (!item.IsBroken)
     {
         m_LogAgent.LogTrace(DataflowNetworkConstituent.Target, m_DecoratedTarget.Title, "Pushing: {0}", item.Title);
         m_DecoratedTarget.Push(item);
         m_LogAgent.LogTrace(DataflowNetworkConstituent.Target, m_DecoratedTarget.Title, "Pushed: {0}", item.Title);
     }
     else
     {
         m_LogAgent.LogTrace(DataflowNetworkConstituent.Target, Title, "Broken message propagated through network. Title: {0}", item.Title);
     }
 }
Exemple #4
0
 public IEnumerable <IDataflowMessage <TOut> > Pull()
 {
     m_LogAgent.LogInfo(DataflowNetworkConstituent.Source, m_DecoratedSource.Title, "Pulling started.");
     foreach (var dfMsg in m_DecoratedSource.Pull())
     {
         Interlocked.Increment(ref m_NumMessagesProcessed);
         m_LogAgent.LogTrace(DataflowNetworkConstituent.Source, m_DecoratedSource.Title, "Pulled source: {0}", dfMsg.Title);
         yield return(dfMsg);
     }
     m_LogAgent.LogInfo(DataflowNetworkConstituent.Source, m_DecoratedSource.Title, "Pulling finished.");
 }
 public void Push(IDataflowMessage <TIn>[] items)
 {
     m_LogAgent.LogTrace(DataflowNetworkConstituent.TargetBatched, m_DecoratedTarget.Title, "Pushing with Batch-Size: {0}", items.Length);
     foreach (IDataflowMessage <TIn> item in items)
     {
         if (!item.IsBroken)
         {
             m_LogAgent.LogTrace(DataflowNetworkConstituent.TargetBatched, m_DecoratedTarget.Title, "Pushing: {0}", item.Title);
         }
         else
         {
             m_LogAgent.LogTrace(DataflowNetworkConstituent.Target, Title, "Broken message propagated through network. Title: {0}", item.Title);
         }
     }
     m_DecoratedTarget.Push(items);
     foreach (IDataflowMessage <TIn> item in items)
     {
         m_LogAgent.LogTrace(DataflowNetworkConstituent.TargetBatched, m_DecoratedTarget.Title, "Pushed: {0}", item.Title);
     }
     m_LogAgent.LogTrace(DataflowNetworkConstituent.TargetBatched, m_DecoratedTarget.Title, "Pushed with Batch-Size: {0}", items.Length);
 }
        public IDataflowMessage <TOut> Transform(IDataflowMessage <TIn>[] items)
        {
            Interlocked.Increment(ref m_NumMessagesProcessed);
            long brokenMessageCnt = 0;
            long totalMessageCnt  = items.LongLength;

            foreach (IDataflowMessage <TIn> item in items)
            {
                if (item.IsBroken)
                {
                    brokenMessageCnt++;
                    m_LogAgent.LogTrace(DataflowNetworkConstituent.TransformationBatched, Title,
                                        "Broken message propagates through network. Node: {0}, Message: {1}", Title,
                                        item.Title);
                }
                else
                {
                    m_LogAgent.LogTrace(DataflowNetworkConstituent.TransformationBatched, m_DecoratedTransformation.Title,
                                        "Transforming: {0}", item.Title);
                }
            }
            m_LogAgent.LogTrace(DataflowNetworkConstituent.TransformationBatched, m_DecoratedTransformation.Title,
                                "Total message count: {0}, broken message count: {1}", totalMessageCnt, brokenMessageCnt);


            IDataflowMessage <TOut> result = m_DecoratedTransformation.Transform(items);

            if (result.IsBroken)
            {
                Interlocked.Increment(ref m_NumBrokenMsgs);
                m_LogAgent.LogBrokenMessage(DataflowNetworkConstituent.Transformation, Title, result.Title, (IBrokenDataFlowMessage <TOut>)result);
            }
            else
            {
                m_LogAgent.LogTrace(DataflowNetworkConstituent.Transformation, m_DecoratedTransformation.Title, "Transformed with Batch-Size: old: {0} new: {1}", items.Length, result.Title);
            }
            return(result);
        }