/// <summary> /// Decode the metadata response from kafka server. /// </summary> /// <param name="data"></param> /// <returns></returns> private MetadataResponse DecodeMetadataResponse(byte[] data) { using (var stream = new BigEndianBinaryReader(data)) { var response = new MetadataResponse(); response.CorrelationId = stream.ReadInt32(); var brokerCount = stream.ReadInt32(); for (var i = 0; i < brokerCount; i++) { response.Brokers.Add(Broker.FromStream(stream)); } var topicCount = stream.ReadInt32(); for (var i = 0; i < topicCount; i++) { response.Topics.Add(Topic.FromStream(stream)); } return(response); } }
/// <summary> /// Decode the metadata response from kafka server. /// </summary> /// <param name="data"></param> /// <returns></returns> private MetadataResponse DecodeMetadataResponse(byte[] data) { var stream = new ReadByteStream(data); var response = new MetadataResponse(); response.CorrelationId = stream.ReadInt(); var brokerCount = stream.ReadInt(); for (var i = 0; i < brokerCount; i++) { response.Brokers.Add(Broker.FromStream(stream)); } var topicCount = stream.ReadInt(); for (var i = 0; i < topicCount; i++) { response.Topics.Add(Topic.FromStream(stream)); } return(response); }