Esempio n. 1
0
        public override void ProcessPartitionData(
            TopicAndPartition topicAndPartition, long fetchOffset, FetchResponsePartitionData partitionData)
        {
            var pti = this.partitionMap.Get(topicAndPartition);
            if (pti.GetFetchOffset() != fetchOffset)
            {
                throw new Exception(string.Format("Offset doesn't match for partition [{0},{1}] pti offset: {2} fetch offset: {3}", topicAndPartition.Topic, topicAndPartition.Partiton, pti.GetFetchOffset(), fetchOffset));
            }

            pti.Enqueue((ByteBufferMessageSet)partitionData.Messages);
        }
        public static TopicData ReadFrom(ByteBuffer buffer)
        {
            var topic                   = ApiUtils.ReadShortString(buffer);
            var partitionCount          = buffer.GetInt();
            var topicPartitionDataPairs = Enumerable.Range(1, partitionCount).Select(
                _ =>
            {
                var partitonId    = buffer.GetInt();
                var partitionData = FetchResponsePartitionData.ReadFrom(buffer);
                return(Tuple.Create(partitonId, partitionData));
            }).ToList();

            return(new TopicData(topic, topicPartitionDataPairs.ToDictionary(k => k.Item1, v => v.Item2)));
        }
Esempio n. 3
0
 /// <summary>
 ///  process fetched Data
 /// </summary>
 /// <param name="topicAndPartition"></param>
 /// <param name="fetchOffset"></param>
 /// <param name="partitionData"></param>
 public abstract void ProcessPartitionData(
     TopicAndPartition topicAndPartition, long fetchOffset, FetchResponsePartitionData partitionData);