Class PushTelemetryResponseFilterInvoker

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

public class PushTelemetryResponseFilterInvoker extends Object implements FilterInvoker
An invoker for PushTelemetryResponseFilter. The point is that this invoker knows the type of PushTelemetryResponseFilter to avoid using instanceof/cast, which has a performance issue in the current LTS java (17).
  • Constructor Summary

    Constructors
    Constructor
    Description
    PushTelemetryResponseFilterInvoker(io.kroxylicious.proxy.filter.PushTelemetryResponseFilter filter)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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)
    Handle deserialized response data.
    boolean
    shouldHandleResponse(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion)
    Should this Invoker handle a response with a given api key and api version.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

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

    onRequest, shouldHandleRequest
  • Constructor Details

    • PushTelemetryResponseFilterInvoker

      public PushTelemetryResponseFilterInvoker(io.kroxylicious.proxy.filter.PushTelemetryResponseFilter filter)
  • Method Details

    • shouldHandleResponse

      public boolean shouldHandleResponse(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion)
      Description copied from interface: FilterInvoker
      Should this Invoker handle a response with a given api key and api version. Returning true implies that this response will be deserialized and FilterInvoker.onResponse(ApiKeys, short, ResponseHeaderData, ApiMessage, FilterContext) is eligible to be called with the deserialized data (if the message flows to that filter).
      Specified by:
      shouldHandleResponse in interface FilterInvoker
      Parameters:
      apiKey - the key of the message
      apiVersion - the version of the message
      Returns:
      true if the message should be deserialized
    • 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)
      Description copied from interface: FilterInvoker

      Handle deserialized response data. Implementations must tolerate being called with responses 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 onResponse called. Implementations should forward responses they do not wish to operate on.

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

      The FilterContext is the factory for FilterResult objects. See FilterContext.forwardResponse(ResponseHeaderData, ApiMessage) and FilterContext.responseFilterResultBuilder() for more details.

      Specified by:
      onResponse 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.ResponseFilterResult>, that when complete, will yield the response to forward.