Class ListConsumerGroupOffsetsHandler
java.lang.Object
org.apache.kafka.clients.admin.internals.ListConsumerGroupOffsetsHandler
- All Implemented Interfaces:
AdminApiHandler<CoordinatorKey,Map<org.apache.kafka.common.TopicPartition, OffsetAndMetadata>>
public class ListConsumerGroupOffsetsHandler
extends Object
implements AdminApiHandler<CoordinatorKey,Map<org.apache.kafka.common.TopicPartition,OffsetAndMetadata>>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.kafka.clients.admin.internals.AdminApiHandler
AdminApiHandler.ApiResult<K,V>, AdminApiHandler.Batched<K, V>, AdminApiHandler.RequestAndKeys<K>, AdminApiHandler.Unbatched<K, V> -
Constructor Summary
ConstructorsConstructorDescriptionListConsumerGroupOffsetsHandler(Map<String, ListConsumerGroupOffsetsSpec> groupSpecs, boolean requireStable, org.apache.kafka.common.utils.LogContext logContext) -
Method Summary
Modifier and TypeMethodDescriptionapiName()Get a user-friendly name for the API this handler is implementing.org.apache.kafka.common.requests.OffsetFetchRequest.BuilderbuildBatchedRequest(Set<CoordinatorKey> groupIds) buildRequest(int brokerId, Set<CoordinatorKey> groupIds) Build the requests necessary for the given keys.AdminApiHandler.ApiResult<CoordinatorKey, Map<org.apache.kafka.common.TopicPartition, OffsetAndMetadata>> handleResponse(org.apache.kafka.common.Node coordinator, Set<CoordinatorKey> groupIds, org.apache.kafka.common.requests.AbstractResponse abstractResponse) Callback that is invoked when a request returns successfully.Get the lookup strategy that is responsible for finding the brokerId which will handle each respective key.static AdminApiFuture.SimpleAdminApiFuture<CoordinatorKey, Map<org.apache.kafka.common.TopicPartition, OffsetAndMetadata>> newFuture(Collection<String> groupIds) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.kafka.clients.admin.internals.AdminApiHandler
handleUnsupportedVersionException
-
Constructor Details
-
ListConsumerGroupOffsetsHandler
public ListConsumerGroupOffsetsHandler(Map<String, ListConsumerGroupOffsetsSpec> groupSpecs, boolean requireStable, org.apache.kafka.common.utils.LogContext logContext)
-
-
Method Details
-
newFuture
public static AdminApiFuture.SimpleAdminApiFuture<CoordinatorKey,Map<org.apache.kafka.common.TopicPartition, newFutureOffsetAndMetadata>> (Collection<String> groupIds) -
apiName
Description copied from interface:AdminApiHandlerGet a user-friendly name for the API this handler is implementing.- Specified by:
apiNamein interfaceAdminApiHandler<CoordinatorKey,Map<org.apache.kafka.common.TopicPartition, OffsetAndMetadata>>
-
lookupStrategy
Description copied from interface:AdminApiHandlerGet the lookup strategy that is responsible for finding the brokerId which will handle each respective key.- Specified by:
lookupStrategyin interfaceAdminApiHandler<CoordinatorKey,Map<org.apache.kafka.common.TopicPartition, OffsetAndMetadata>> - Returns:
- non-null lookup strategy
-
buildBatchedRequest
public org.apache.kafka.common.requests.OffsetFetchRequest.Builder buildBatchedRequest(Set<CoordinatorKey> groupIds) -
buildRequest
public Collection<AdminApiHandler.RequestAndKeys<CoordinatorKey>> buildRequest(int brokerId, Set<CoordinatorKey> groupIds) Description copied from interface:AdminApiHandlerBuild the requests necessary for the given keys. The set of keys is derived byAdminApiDriverduring the lookup stage as the set of keys which all map to the same destination broker. Handlers can choose to issue a single request for all of the provided keys (seeAdminApiHandler.Batched, issue one request per key (seeAdminApiHandler.Unbatched, or implement their own custom grouping logic if necessary.- Specified by:
buildRequestin interfaceAdminApiHandler<CoordinatorKey,Map<org.apache.kafka.common.TopicPartition, OffsetAndMetadata>> - Parameters:
brokerId- the target brokerId for the requestgroupIds- the set of keys that should be handled by this request- Returns:
- a collection of
AdminApiHandler.RequestAndKeysfor the requests containing the given keys
-
handleResponse
public AdminApiHandler.ApiResult<CoordinatorKey,Map<org.apache.kafka.common.TopicPartition, handleResponseOffsetAndMetadata>> (org.apache.kafka.common.Node coordinator, Set<CoordinatorKey> groupIds, org.apache.kafka.common.requests.AbstractResponse abstractResponse) Description copied from interface:AdminApiHandlerCallback that is invoked when a request returns successfully. The handler should parse the response, check for errors, and return a result which indicates which keys (if any) have either been completed or failed with an unrecoverable error. It is also possible that the response indicates an incorrect target brokerId (e.g. in the case of a NotLeader error when the request is bound for a partition leader). In this case the key will be "unmapped" from the target brokerId and lookup will be retried. Note that keys which received a retriable error should be left out of the result. They will be retried automatically.- Specified by:
handleResponsein interfaceAdminApiHandler<CoordinatorKey,Map<org.apache.kafka.common.TopicPartition, OffsetAndMetadata>> - Parameters:
coordinator- the broker that the associated request was sent togroupIds- the set of keys from the associated requestabstractResponse- the response received from the broker- Returns:
- result indicating key completion, failure, and unmapping
-