Esempio n. 1
0
        internal static Broker ParseFrom(KafkaBinaryReader reader)
        {
            var id   = reader.ReadInt32();
            var host = KafkaPrimitiveTypes.ReadShortString(reader, KafkaRequest.DefaultEncoding);
            var port = reader.ReadInt32();

            return(new Broker(id, host, port));
        }
        internal static TopicMetadataResponseTopicInfo ParseFrom(KafkaBinaryReader reader, Dictionary <int, Broker> brokers)
        {
            var errorCode          = reader.ReadInt16();
            var topic              = KafkaPrimitiveTypes.ReadShortString(reader, KafkaRequest.DefaultEncoding);
            var numPartitions      = reader.ReadInt32();
            var partitionsMetadata = new List <TopicMetadataResponsePartitionInfo>();

            for (int i = 0; i < numPartitions; i++)
            {
                partitionsMetadata.Add(TopicMetadataResponsePartitionInfo.ParseFrom(reader, brokers));
            }
            return(new TopicMetadataResponseTopicInfo(topic, partitionsMetadata, errorCode));
        }