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); }
public void Push(IDataflowMessage <TIn> item) { try { if (!item.IsBroken) { m_DecoratedTarget.Push(item.Data); } } catch (DataflowNetworkUnrecoverableErrorException ex) { m_LogAgent.LogFatal(DataflowNetworkConstituent.Target, m_DecoratedTarget.Title, ex); // Halt the entire dataflow network. m_Cancel.CancelNetwork(); } catch (DataflowNetworkRecoverableErrorException ex) { var broken = new BrokenDataflowMessage <TIn>(ex, item.Data); m_LogAgent.LogBrokenMessage(DataflowNetworkConstituent.Target, Title, item.Title, broken); } }
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); }