Class SpecificFilterArrayInvoker

java.lang.Object
io.kroxylicious.proxy.internal.filter.SpecificFilterArrayInvoker
All Implemented Interfaces:
FilterInvoker

public class SpecificFilterArrayInvoker extends Object implements FilterInvoker
Invoker for Filters that implement any number of Specific Message interfaces (for example AlterConfigsResponseFilter.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SpecificFilterArrayInvoker(io.kroxylicious.proxy.filter.Filter filter)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    implementsAnySpecificRequestFilterInterface(io.kroxylicious.proxy.filter.Filter filter)
    Check if a Filter implements any of the Specific Request Filter interfaces
    static boolean
    implementsAnySpecificResponseFilterInterface(io.kroxylicious.proxy.filter.Filter filter)
    Check if a Filter implements any of the Specific Response Filter interfaces
    CompletionStage<io.kroxylicious.proxy.filter.RequestFilterResult>
    onRequest(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion, org.apache.kafka.common.message.RequestHeaderData header, org.apache.kafka.common.protocol.ApiMessage body, io.kroxylicious.proxy.filter.FilterContext filterContext)
    Apply the filter to the given header and body using the given filterContext.
    CompletionStage<io.kroxylicious.proxy.filter.ResponseFilterResult>
    onResponse(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion, org.apache.kafka.common.message.ResponseHeaderData header, org.apache.kafka.common.protocol.ApiMessage body, io.kroxylicious.proxy.filter.FilterContext filterContext)
    Apply the filter to the given header and body using the given filterContext.
    boolean
    shouldHandleRequest(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion)
    Determines whether a request with the given apiKey and apiVersion should be deserialized.
    boolean
    shouldHandleResponse(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion)
    Determines whether a response with the given apiKey and apiVersion should be deserialized.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SpecificFilterArrayInvoker

      public SpecificFilterArrayInvoker(io.kroxylicious.proxy.filter.Filter filter)
  • Method Details

    • onRequest

      public CompletionStage<io.kroxylicious.proxy.filter.RequestFilterResult> onRequest(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion, org.apache.kafka.common.message.RequestHeaderData header, org.apache.kafka.common.protocol.ApiMessage body, io.kroxylicious.proxy.filter.FilterContext filterContext)
      Apply the filter to the given header and body using the given filterContext.
      Specified by:
      onRequest in interface FilterInvoker
      Parameters:
      apiKey - The request api key.
      apiVersion - The request api version.
      header - The request header.
      body - The request body.
      filterContext - The filter context.
      Returns:
      a CompletionStage<io.kroxylicious.proxy.filter.RequestFilterResult>, that when complete, will yield the request to forward.
    • onResponse

      public CompletionStage<io.kroxylicious.proxy.filter.ResponseFilterResult> onResponse(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion, org.apache.kafka.common.message.ResponseHeaderData header, org.apache.kafka.common.protocol.ApiMessage body, io.kroxylicious.proxy.filter.FilterContext filterContext)
      Apply the filter to the given header and body using the given filterContext.
      Specified by:
      onResponse in interface FilterInvoker
      Parameters:
      apiKey - The request api key.
      apiVersion - The api version.
      header - The request header.
      body - The request body.
      filterContext - The filter context.
      Returns:
      a CompletionStage<io.kroxylicious.proxy.filter.ResponseFilterResult>, that when complete, will yield the response to forward.
    • shouldHandleRequest

      public boolean shouldHandleRequest(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion)

      Determines whether a request with the given apiKey and apiVersion should be deserialized. Note that it is not guaranteed that this method will be called once per request, or that two consecutive calls refer to the same request. That is, the sequences of invocations like the following are allowed:

      1. shouldHandleRequest on request A
      2. shouldHandleRequest on request B
      3. shouldHandleRequest on request A
      4. onRequest on request A
      5. onRequest on request B
      Specified by:
      shouldHandleRequest in interface FilterInvoker
      Parameters:
      apiKey - The API key
      apiVersion - The API version
      Returns:
      true if request should be deserialized
    • shouldHandleResponse

      public boolean shouldHandleResponse(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion)

      Determines whether a response with the given apiKey and apiVersion should be deserialized. Note that it is not guaranteed that this method will be called once per response, or that two consecutive calls refer to the same response. That is, the sequences of invocations like the following are allowed:

      1. shouldHandleResponse on response A
      2. shouldHandleResponse on response B
      3. shouldHandleResponse on response A
      4. apply on response A
      5. apply on response B
      Specified by:
      shouldHandleResponse in interface FilterInvoker
      Parameters:
      apiKey - The API key
      apiVersion - The API version
      Returns:
      true if response should be deserialized
    • implementsAnySpecificRequestFilterInterface

      public static boolean implementsAnySpecificRequestFilterInterface(io.kroxylicious.proxy.filter.Filter filter)
      Check if a Filter implements any of the Specific Request Filter interfaces
      Parameters:
      filter - the filter
      Returns:
      true if the filter implements any Specific Request Filter interfaces
    • implementsAnySpecificResponseFilterInterface

      public static boolean implementsAnySpecificResponseFilterInterface(io.kroxylicious.proxy.filter.Filter filter)
      Check if a Filter implements any of the Specific Response Filter interfaces
      Parameters:
      filter - the filter
      Returns:
      true if the filter implements any Specific Response Filter interfaces