Browse Source

Add support for FetchRequest API V3.

This commit adds support for version 3 of the FetchRequest API. The
KIP can be found here:

    https://cwiki.apache.org/confluence/display/KAFKA/KIP-74%3A+Add+Fetch+Response+Size+Limit+in+Bytes

the PR here:

    https://github.com/apache/kafka/pull/1812

and the JIRA here:

    https://issues.apache.org/jira/browse/KAFKA-2063

Should document the fact that the per-partition limits take
precedence (so the returned message may be larger than the
requested limit).
Michael Herstine 8 years ago
parent
commit
b69551c88b
2 changed files with 3 additions and 1 deletions
  1. 1 1
      consumer.go
  2. 2 0
      fetch_request.go

+ 1 - 1
consumer.go

@@ -728,7 +728,7 @@ func (bc *brokerConsumer) fetchNewMessages() (*FetchResponse, error) {
 	}
 	if bc.consumer.conf.Version.IsAtLeast(V0_10_1_0) {
 		request.Version = 3
-		request.MaxBytes = MaxResponseSize - 47 // TODO(mherstin): WTF?!
+		request.MaxBytes = MaxResponseSize
 	}
 
 	for child := range bc.subscriptions {

+ 2 - 0
fetch_request.go

@@ -126,6 +126,8 @@ func (r *FetchRequest) requiredVersion() KafkaVersion {
 		return V0_9_0_0
 	case 2:
 		return V0_10_0_0
+	case 3:
+		return V0_10_1_0
 	default:
 		return minVersion
 	}