예제 #1
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 IEnumerable <IDataflowMessage <TOut> > Pull()
 {
     foreach (var dfMsg in m_DecoratedFunctor.Pull())
     {
         Interlocked.Increment(ref NumProcessedMessages);
         if (dfMsg.IsBroken)
         {
             Interlocked.Increment(ref NumBrokenMessages);
         }
         yield return(dfMsg);
     }
 }
예제 #3
0
        public IEnumerable <IDataflowMessage <TOut> > Pull()
        {
            foreach (var dataflowMessage in m_DecoratedSource.Pull())
            {
                if (dataflowMessage == null || dataflowMessage.IsEmpty)
                {
                    continue;
                }

                yield return(dataflowMessage);
            }
        }
예제 #4
0
        public IEnumerable <IDataflowMessage <TOut> > Pull()
        {
            // Unfortunately, this guy can't do much, because he will either have to enumerate the enumerable
            // (thereby materializing it) or just delay the computation further as is the case here.
            //// return m_DecoratedSource.Pull().Select(item => new DefaultDataflowMessage<TOut>(item.Data).WithTitle(Title));
            m_nms = 0;
            var res = m_DecoratedSource.Pull().Select(item =>
            {
                var dfm = new DefaultDataflowMessage <TOut>(item.Data).WithTitle(Title);
                m_nms++;
                Send(new WorkloadStatisticsContext(this.GroupGuid, this.TaskGuid, m_nms, -1, m_OutMsgFunc(), GetBoundedCapacity(), Title));
                return(dfm);
            });

            return(res);
        }