示例#1
0
        /// <inheritdoc />
        public override IMemberMetadata DecodeMetadata(IKafkaReader reader)
        {
            var version    = reader.ReadInt16();
            var topicNames = new string[reader.ReadInt32()];

            for (var t = 0; t < topicNames.Length; t++)
            {
                topicNames[t] = reader.ReadString();
            }
            var userData = reader.ReadBytes();

            return(new ConsumerProtocolMetadata(version, topicNames, userData));
        }
示例#2
0
        /// <inheritdoc />
        protected override ConsumerProtocolMetadata DecodeMetadata(string assignmentStrategy, IKafkaReader reader, int expectedLength)
        {
            var version    = reader.ReadInt16();
            var topicNames = new string[reader.ReadInt32()];

            for (var t = 0; t < topicNames.Length; t++)
            {
                topicNames[t] = reader.ReadString();
            }
            var userData = reader.ReadBytes();

            return(new ConsumerProtocolMetadata(topicNames, assignmentStrategy, userData, version));
        }
示例#3
0
        /// <inheritdoc />
        public override IMemberAssignment DecodeAssignment(IKafkaReader reader)
        {
            var version = reader.ReadInt16();

            var topics     = new List <TopicPartition>();
            var topicCount = reader.ReadInt32();

            for (var t = 0; t < topicCount; t++)
            {
                var topicName = reader.ReadString();

                var partitionCount = reader.ReadInt32();
                for (var p = 0; p < partitionCount; p++)
                {
                    var partitionId = reader.ReadInt32();
                    topics.Add(new TopicPartition(topicName, partitionId));
                }
            }
            return(new ConsumerMemberAssignment(version, topics));
        }
示例#4
0
        /// <inheritdoc />
        protected override ConsumerMemberAssignment DecodeAssignment(IKafkaReader reader, int expectedLength)
        {
            var version = reader.ReadInt16();

            var topics     = new List <TopicPartition>();
            var topicCount = reader.ReadInt32();

            for (var t = 0; t < topicCount; t++)
            {
                var topicName = reader.ReadString();

                var partitionCount = reader.ReadInt32();
                for (var p = 0; p < partitionCount; p++)
                {
                    var partitionId = reader.ReadInt32();
                    topics.Add(new TopicPartition(topicName, partitionId));
                }
            }
            var userData = reader.ReadBytes();

            return(new ConsumerMemberAssignment(topics, userData, version));
        }