Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 5
0
 public static ErrorResponseCode ReadErrorCode(this IKafkaReader reader)
 {
     return((ErrorResponseCode)reader.ReadInt16());
 }