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.
  • Constructor Details

    • Unbatched

      public Unbatched()
  • Method Details

    • buildRequest

      public final Collection<AdminApiHandler.RequestAndKeys<K>> buildRequest(int brokerId, Set<K> keys)
      Description copied from interface: AdminApiHandler
      Build the requests necessary for the given keys. The set of keys is derived by AdminApiDriver during 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 (see AdminApiHandler.Batched, issue one request per key (see AdminApiHandler.Unbatched, or implement their own custom grouping logic if necessary.
      Specified by:
      buildRequest in interface AdminApiHandler<K,V>
      Parameters:
      brokerId - the target brokerId for the request
      keys - the set of keys that should be handled by this request
      Returns:
      a collection of AdminApiHandler.RequestAndKeys for 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: AdminApiHandler
      Callback 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:
      handleResponse in interface AdminApiHandler<K,V>
      Parameters:
      broker - the broker that the associated request was sent to
      keys - the set of keys from the associated request
      response - the response received from the broker
      Returns:
      result indicating key completion, failure, and unmapping