|
|
@ -58,7 +58,7 @@ object FetchRequest { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
case class FetchRequest(versionId: Short = FetchRequest.CurrentVersion, |
|
|
|
case class FetchRequest private[kafka] (versionId: Short = FetchRequest.CurrentVersion, |
|
|
|
correlationId: Int = FetchRequest.DefaultCorrelationId, |
|
|
|
correlationId: Int = FetchRequest.DefaultCorrelationId, |
|
|
|
clientId: String = ConsumerConfig.DefaultClientId, |
|
|
|
clientId: String = ConsumerConfig.DefaultClientId, |
|
|
|
replicaId: Int = Request.OrdinaryConsumerId, |
|
|
|
replicaId: Int = Request.OrdinaryConsumerId, |
|
|
@ -72,6 +72,23 @@ case class FetchRequest(versionId: Short = FetchRequest.CurrentVersion, |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
lazy val requestInfoGroupedByTopic = requestInfo.groupBy(_._1.topic) |
|
|
|
lazy val requestInfoGroupedByTopic = requestInfo.groupBy(_._1.topic) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Public constructor for the clients |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
def this(correlationId: Int, |
|
|
|
|
|
|
|
clientId: String, |
|
|
|
|
|
|
|
maxWait: Int, |
|
|
|
|
|
|
|
minBytes: Int, |
|
|
|
|
|
|
|
requestInfo: Map[TopicAndPartition, PartitionFetchInfo]) { |
|
|
|
|
|
|
|
this(versionId = FetchRequest.CurrentVersion, |
|
|
|
|
|
|
|
correlationId = correlationId, |
|
|
|
|
|
|
|
clientId = clientId, |
|
|
|
|
|
|
|
replicaId = Request.OrdinaryConsumerId, |
|
|
|
|
|
|
|
maxWait = maxWait, |
|
|
|
|
|
|
|
minBytes= minBytes, |
|
|
|
|
|
|
|
requestInfo = requestInfo) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
def writeTo(buffer: ByteBuffer) { |
|
|
|
def writeTo(buffer: ByteBuffer) { |
|
|
|
buffer.putShort(versionId) |
|
|
|
buffer.putShort(versionId) |
|
|
|
buffer.putInt(correlationId) |
|
|
|
buffer.putInt(correlationId) |
|
|
@ -144,7 +161,10 @@ class FetchRequestBuilder() { |
|
|
|
this |
|
|
|
this |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
def replicaId(replicaId: Int): FetchRequestBuilder = { |
|
|
|
/** |
|
|
|
|
|
|
|
* Only for internal use. Clients shouldn't set replicaId. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private[kafka] def replicaId(replicaId: Int): FetchRequestBuilder = { |
|
|
|
this.replicaId = replicaId |
|
|
|
this.replicaId = replicaId |
|
|
|
this |
|
|
|
this |
|
|
|
} |
|
|
|
} |
|
|
|