public AccumulatorByTopicByPartition(Func <TData, string> topicFromData, Func <TData, int> partitionFromData, int maxCount, TimeSpan timeWindow) : base(maxCount, timeWindow) { _topicFromData = topicFromData; _partitionFromData = partitionFromData; _currentBatch = BatchByTopicByPartition <TData> .New(); }
protected override void Accumulate(Tuple <INode, TData> data) { BatchByTopicByPartition <TData> batch; if (!_currentBatches.TryGetValue(data.Item1, out batch)) { batch = BatchByTopicByPartition <TData> .New(); _currentBatches[data.Item1] = batch; } batch.Add(_topicFromData(data.Item2), _partitionFromData(data.Item2), data.Item2); }
protected override void OnNewBatch(int count) { NewBatch(_currentBatch); _currentBatch = BatchByTopicByPartition <TData> .New(); }