Class FetchRequestManager
java.lang.Object
org.apache.kafka.clients.consumer.internals.AbstractFetch
org.apache.kafka.clients.consumer.internals.FetchRequestManager
- All Implemented Interfaces:
Closeable,AutoCloseable,RequestManager
FetchRequestManager is responsible for generating FetchRequest that represent the
SubscriptionState.fetchablePartitions(Predicate) based on the user's topic subscription/partition
assignment.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.kafka.clients.consumer.internals.AbstractFetch
AbstractFetch.ResponseHandler<T> -
Field Summary
Fields inherited from class org.apache.kafka.clients.consumer.internals.AbstractFetch
decompressionBufferSupplier, fetchBuffer, fetchConfig, logContext, metadata, metricsManager, nodesWithPendingFetchRequests, subscriptions, time -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanisUnavailable(org.apache.kafka.common.Node node) Check if the node is disconnected and unavailable for immediate reconnection (i.e.protected voidmaybeThrowAuthFailure(org.apache.kafka.common.Node node) Checks for an authentication error on a given node and throws the exception if it exists.poll(long currentTimeMs) During normal operation of theConsumer, a request manager may need to send out network requests.On shutdown of theConsumer, a request manager may need to send out network requests.Methods inherited from class org.apache.kafka.clients.consumer.internals.AbstractFetch
close, close, closeInternal, createFetchRequest, handleCloseFetchSessionFailure, handleCloseFetchSessionSuccess, handleFetchFailure, handleFetchSuccess, hasAvailableFetches, prepareCloseFetchSessionRequests, prepareFetchRequests, sessionHandlerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.kafka.clients.consumer.internals.RequestManager
maximumTimeToWait, signalClose
-
Method Details
-
maybeThrowAuthFailure
protected void maybeThrowAuthFailure(org.apache.kafka.common.Node node) Description copied from class:AbstractFetchChecks for an authentication error on a given node and throws the exception if it exists.- Specified by:
maybeThrowAuthFailurein classAbstractFetch- Parameters:
node-Nodeto check for a previousAuthenticationException; if found it is thrown- See Also:
-
poll
During normal operation of theConsumer, a request manager may need to send out network requests. Implementations can returntheir need for network I/Oby returning the requests here. This method is called within a single-threaded context fromthe consumer's network I/O thread. As such, there should be no need for synchronization protection in this method's implementation. Note: no network I/O occurs in this method. The method itself should not block for any reason. This method is called from the consumer's network I/O thread, so quick execution of this method in all request managers is critical to ensure that we can heartbeat in a timely fashion.- Specified by:
pollin interfaceRequestManager- Parameters:
currentTimeMs- The current system time at which the method was called; useful for determining if time-sensitive operations should be performed
-
pollOnClose
On shutdown of theConsumer, a request manager may need to send out network requests. Implementations can signal that by returning thecloserequests here. LikeRequestManager.poll(long), this method is called within a single-threaded context fromthe consumer's network I/O thread. As such, there should be no need for synchronization protection in this method's implementation. Note: no network I/O occurs in this method. The method itself should not block for any reason. This method is called as an (indirect) result ofthe consumer's close methodbeing invoked. (Note that it is still invoked on the consumer's network I/O thread). Quick execution of this method in all request managers is critical to ensure that we can complete as many of the consumer's shutdown tasks as possible within the user-provided timeout.- Specified by:
pollOnClosein interfaceRequestManager