Class AdminApiHandler.Unbatched<K,V>
java.lang.Object
org.apache.kafka.clients.admin.internals.AdminApiHandler.Unbatched<K,V>
- All Implemented Interfaces:
AdminApiHandler<K,V>
- Direct Known Subclasses:
FenceProducersHandler
- Enclosing interface:
AdminApiHandler<K,V>
public abstract static class AdminApiHandler.Unbatched<K,V>
extends Object
implements AdminApiHandler<K,V>
An
AdminApiHandler that will create one request per key, not performing any grouping based
on the targeted broker. This type of handler should only be used for broker APIs that do not accept
multiple keys at once, such as initializing a transactional producer.-
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildRequest(int brokerId, Set<K> keys) Build the requests necessary for the given keys.final AdminApiHandler.ApiResult<K, V> handleResponse(org.apache.kafka.common.Node broker, Set<K> keys, org.apache.kafka.common.requests.AbstractResponse response) Callback that is invoked when a request returns successfully.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
apiName, handleUnsupportedVersionException, lookupStrategy
-
Constructor Details
-
Unbatched
public Unbatched()
-
-
Method Details
-
buildRequest
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<K,V> - Parameters:
brokerId- the target brokerId for the requestkeys- 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 final AdminApiHandler.ApiResult<K,V> handleResponse(org.apache.kafka.common.Node broker, Set<K> keys, org.apache.kafka.common.requests.AbstractResponse response) 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<K,V> - Parameters:
broker- the broker that the associated request was sent tokeys- the set of keys from the associated requestresponse- the response received from the broker- Returns:
- result indicating key completion, failure, and unmapping
-