Class FetchCollector<K,V>
java.lang.Object
org.apache.kafka.clients.consumer.internals.FetchCollector<K,V>
- Type Parameters:
K- Record key typeV- Record value type
FetchCollector operates at the RecordBatch level, as that is what is stored in the
FetchBuffer. Each Record in the RecordBatch is converted
to a ConsumerRecord and added to the returned Fetch.-
Constructor Summary
ConstructorsConstructorDescriptionFetchCollector(org.apache.kafka.common.utils.LogContext logContext, ConsumerMetadata metadata, SubscriptionState subscriptions, FetchConfig fetchConfig, Deserializers<K, V> deserializers, FetchMetricsManager metricsManager, org.apache.kafka.common.utils.Time time) -
Method Summary
Modifier and TypeMethodDescriptioncollectFetch(FetchBuffer fetchBuffer) Return the fetchedrecords, empty therecord buffer, and update the consumed position.protected CompletedFetchinitialize(CompletedFetch completedFetch) Initialize a CompletedFetch object.
-
Constructor Details
-
FetchCollector
public FetchCollector(org.apache.kafka.common.utils.LogContext logContext, ConsumerMetadata metadata, SubscriptionState subscriptions, FetchConfig fetchConfig, Deserializers<K, V> deserializers, FetchMetricsManager metricsManager, org.apache.kafka.common.utils.Time time)
-
-
Method Details
-
collectFetch
Return the fetchedrecords, empty therecord buffer, and update the consumed position. NOTE: returning anemptyfetch guarantees the consumed position is not updated.- Parameters:
fetchBuffer-FetchBufferfrom which to retrieve therecords- Returns:
- A
Fetchfor the requested partitions - Throws:
OffsetOutOfRangeException- If there is OffsetOutOfRange error in fetchResponse and the defaultResetPolicy is NONEorg.apache.kafka.common.errors.TopicAuthorizationException- If there is TopicAuthorization error in fetchResponse.
-
initialize
Initialize a CompletedFetch object.
-