Record Class RequestFilterInvoker

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

public record RequestFilterInvoker(io.kroxylicious.proxy.filter.RequestFilter filter) extends Record implements FilterInvoker
  • Constructor Summary

    Constructors
    Constructor
    Description
    RequestFilterInvoker(io.kroxylicious.proxy.filter.RequestFilter filter)
    Creates an instance of a RequestFilterInvoker record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    io.kroxylicious.proxy.filter.RequestFilter
    Returns the value of the filter record component.
    final int
    Returns a hash code value for this object.
    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)
    Handle deserialized request data.
    boolean
    shouldHandleRequest(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion)
    Should this Invoker handle a request with a given api key and api version.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.kroxylicious.proxy.internal.filter.FilterInvoker

    onResponse, shouldHandleResponse
  • Constructor Details

    • RequestFilterInvoker

      public RequestFilterInvoker(io.kroxylicious.proxy.filter.RequestFilter filter)
      Creates an instance of a RequestFilterInvoker record class.
      Parameters:
      filter - the value for the filter record component
  • 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)
      Description copied from interface: FilterInvoker

      Handle deserialized request data. Implementations must tolerate being called with requests that this FilterInvoker is NOT interested in handling. If any FilterInvoker in the chain should handle a response, then all invokers in the chain are eligible to have their onRequest called. Implementations should forward requests they do not wish to operate on.

      Filters must return a CompletionStage<io.kroxylicious.proxy.filter.RequestFilterResult> object. This object encapsulates the request to be forwarded and, optionally, orders for actions such as closing the connection or dropping the request.

      The FilterContext is the factory for FilterResult objects. See FilterContext.forwardRequest(RequestHeaderData, ApiMessage) and FilterContext.requestFilterResultBuilder() for more details.

      Specified by:
      onRequest in interface FilterInvoker
      Parameters:
      apiKey - the key of the message
      apiVersion - the apiVersion of the message
      header - the header of the message
      body - the body of the message
      filterContext - contains methods to continue the filter chain and other contextual data
      Returns:
      a CompletionStage<io.kroxylicious.proxy.filter.RequestFilterResult>, that when complete, will yield the request to forward.
    • shouldHandleRequest

      public boolean shouldHandleRequest(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion)
      Description copied from interface: FilterInvoker
      Should this Invoker handle a request with a given api key and api version. Returning true implies that this request will be deserialized and FilterInvoker.onRequest(ApiKeys, short, RequestHeaderData, ApiMessage, FilterContext) is eligible to be called with the deserialized data (if the message flows to that filter).
      Specified by:
      shouldHandleRequest in interface FilterInvoker
      Parameters:
      apiKey - the key of the message
      apiVersion - the version of the message
      Returns:
      true if the message should be deserialized
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • filter

      public io.kroxylicious.proxy.filter.RequestFilter filter()
      Returns the value of the filter record component.
      Returns:
      the value of the filter record component