Class SpecificFilterArrayInvoker
java.lang.Object
io.kroxylicious.proxy.internal.filter.SpecificFilterArrayInvoker
- All Implemented Interfaces:
FilterInvoker
Invoker for Filters that implement any number of Specific Message interfaces (for
example
AlterConfigsResponseFilter.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanimplementsAnySpecificRequestFilterInterface(io.kroxylicious.proxy.filter.Filter filter) Check if a Filter implements any of the Specific Request Filter interfacesstatic booleanimplementsAnySpecificResponseFilterInterface(io.kroxylicious.proxy.filter.Filter filter) Check if a Filter implements any of the Specific Response Filter interfacesCompletionStage<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 givenheaderandbodyusing the givenfilterContext.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 givenheaderandbodyusing the givenfilterContext.booleanshouldHandleRequest(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion) Determines whether a request with the givenapiKeyandapiVersionshould be deserialized.booleanshouldHandleResponse(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion) Determines whether a response with the givenapiKeyandapiVersionshould be deserialized.
-
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 givenheaderandbodyusing the givenfilterContext.- Specified by:
onRequestin interfaceFilterInvoker- 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 givenheaderandbodyusing the givenfilterContext.- Specified by:
onResponsein interfaceFilterInvoker- 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
apiKeyandapiVersionshould 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:shouldHandleRequeston request AshouldHandleRequeston request BshouldHandleRequeston request AonRequeston request AonRequeston request B
- Specified by:
shouldHandleRequestin interfaceFilterInvoker- Parameters:
apiKey- The API keyapiVersion- 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
apiKeyandapiVersionshould 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:shouldHandleResponseon response AshouldHandleResponseon response BshouldHandleResponseon response Aapplyon response Aapplyon response B
- Specified by:
shouldHandleResponsein interfaceFilterInvoker- Parameters:
apiKey- The API keyapiVersion- 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
-