Interface ResponseFilter

All Superinterfaces:
Filter

public interface ResponseFilter extends Filter

A Filter that handles all response types.

When a Filter implements ResponseFilter:

  • it must not also implement any of the message-specific *ResponseFilter interfaces like ApiVersionsResponseFilter.
  • it may also implement either RequestFilter or any of the message-specific *RequestFilter interfaces, but not both.
  • Method Summary

    Modifier and Type
    Method
    Description
    onResponse(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion, org.apache.kafka.common.message.ResponseHeaderData header, org.apache.kafka.common.protocol.ApiMessage response, FilterContext context)
    Handle the given header and response pair, returning the header and response pair to be passed to the next filter using the ResponseFilterResult.
    onResponse(org.apache.kafka.common.protocol.ApiKeys apiKey, org.apache.kafka.common.message.ResponseHeaderData header, org.apache.kafka.common.protocol.ApiMessage response, FilterContext context)
    Deprecated, for removal: This API element is subject to removal in a future version.
    default boolean
    shouldHandleResponse(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion)
    Does this filter implementation want to handle a response.
  • Method Details

    • shouldHandleResponse

      default boolean shouldHandleResponse(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion)
      Does this filter implementation want to handle a response. If so, the onResponse(ApiKeys, short, ResponseHeaderData, ApiMessage, FilterContext) method will be eligible to be called with the deserialized response data (if the message reaches this filter in the filter chain).
      Parameters:
      apiKey - the api key of the message
      apiVersion - the api version of the message
      Returns:
      true if this filter wants to handle the response
    • onResponse

      @Deprecated(forRemoval=true, since="0.19.0") default CompletionStage<ResponseFilterResult> onResponse(org.apache.kafka.common.protocol.ApiKeys apiKey, org.apache.kafka.common.message.ResponseHeaderData header, org.apache.kafka.common.protocol.ApiMessage response, FilterContext context)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Handle the given header and response pair, returning the header and response pair to be passed to the next filter using the ResponseFilterResult.
      The implementation may modify the given header and response in-place, or instantiate a new instances.
      Parameters:
      apiKey - key of the response
      header - response header.
      response - The body to handle.
      context - The context.
      Returns:
      a non-null CompletionStage that, when complete, will yield a ResponseFilterResult containing the response to be forwarded.
      See Also:
    • onResponse

      default CompletionStage<ResponseFilterResult> onResponse(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion, org.apache.kafka.common.message.ResponseHeaderData header, org.apache.kafka.common.protocol.ApiMessage response, FilterContext context)
      Handle the given header and response pair, returning the header and response pair to be passed to the next filter using the ResponseFilterResult.
      The implementation may modify the given header and response in-place, or instantiate a new instances.
      Parameters:
      apiKey - key of the response
      apiVersion - api version of the response
      header - response header.
      response - The body to handle.
      context - The context.
      Returns:
      a non-null CompletionStage that, when complete, will yield a ResponseFilterResult containing the response to be forwarded.
      See Also: