Interface RequestFilterResultBuilder

All Superinterfaces:
CloseStage<RequestFilterResult>, FilterResultBuilder<org.apache.kafka.common.message.RequestHeaderData,RequestFilterResult>

public interface RequestFilterResultBuilder extends FilterResultBuilder<org.apache.kafka.common.message.RequestHeaderData,RequestFilterResult>
Builder for request filter results.
See RequestFilterResult for a description of short-circuit responses.
  • Method Details

    • shortCircuitResponse

      CloseOrTerminalStage<RequestFilterResult> shortCircuitResponse(@Nullable org.apache.kafka.common.message.ResponseHeaderData header, org.apache.kafka.common.protocol.ApiMessage message) throws IllegalArgumentException
      A short-circuit response towards the client.
      Parameters:
      header - response header. May be null.
      message - response message. May not be null. the response messages the class must have one that ends with ResponseData.
      Returns:
      next stage in the fluent builder API
      Throws:
      IllegalArgumentException - header or message do not meet criteria described above.
    • shortCircuitResponse

      CloseOrTerminalStage<RequestFilterResult> shortCircuitResponse(org.apache.kafka.common.protocol.ApiMessage message) throws IllegalArgumentException
      A short-circuit response towards the client.
      Parameters:
      message - response message. May not be null. the response messages the class must have one that ends with ResponseData.
      Returns:
      next stage in the fluent builder API
      Throws:
      IllegalArgumentException - header or message do not meet criteria described above.
    • errorResponse

      CloseOrTerminalStage<RequestFilterResult> errorResponse(org.apache.kafka.common.message.RequestHeaderData header, org.apache.kafka.common.protocol.ApiMessage requestMessage, org.apache.kafka.common.errors.ApiException apiException) throws IllegalArgumentException
      Generate a short-circuit error response towards the client. The generated error response is API-specific, and add an error code (corresponding to the ApiException), and possibly error message (from the message of the ApiException), either at the top level of the response (if the API for the response has a global error code), or for all entities given in the request (if the API for the response has only-per entity error codes).
      Parameters:
      header - the headers from the request
      requestMessage - the API request message to generate an error in response too.
      apiException - the exception that triggered the error response. Note Kafka will map the exception to an using so callers may wish to supply choose their exception to trigger the appropriate error code
      Returns:
      next stage in the fluent builder API
      Throws:
      IllegalArgumentException - header or message do not meet criteria described above.