/// <summary> /// Fetch a set of messages from a topic. /// </summary> /// <param name="request"> specifies the topic name, topic partition, starting byte offset, maximum bytes to be fetched.</param> /// <returns></returns> internal FetchResponse Fetch(FetchRequest request) { Receive response = null; var specificTimer = this.fetchRequestAndResponseStats.GetFetchRequestAndResponseStats(this.BrokerInfo).RequestTimer; var aggregateTimer = this.fetchRequestAndResponseStats.GetFetchRequestAndResponseAllBrokersStats().RequestTimer; aggregateTimer.Time(() => specificTimer.Time(() => { response = this.SendRequest(request); })); var fetchResponse = FetchResponse.ReadFrom(response.Buffer); var fetchedSize = fetchResponse.SizeInBytes; this.fetchRequestAndResponseStats.GetFetchRequestAndResponseStats(this.BrokerInfo).RequestSizeHist.Update(fetchedSize); this.fetchRequestAndResponseStats.GetFetchRequestAndResponseAllBrokersStats().RequestSizeHist.Update(fetchedSize); return(fetchResponse); }