Package io.kroxylicious.proxy.filter
Interface RequestFilter
- All Superinterfaces:
Filter
A Filter that handles all request types, for example to modify the request headers.
When a Filter implements RequestFilter:
- it must not also implement any of the message-specific
*RequestFilterinterfaces likeApiVersionsRequestFilter. - it may also implement either
ResponseFilteror any of the message-specific*ResponseFilterinterfaces, but not both.
-
Method Summary
Modifier and TypeMethodDescriptiondefault CompletionStage<RequestFilterResult> onRequest(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion, org.apache.kafka.common.message.RequestHeaderData header, org.apache.kafka.common.protocol.ApiMessage request, FilterContext context) Handle the givenheaderandrequestpair, returning theheaderandrequestpair to be passed to the next filter using the RequestFilterResult.default CompletionStage<RequestFilterResult> onRequest(org.apache.kafka.common.protocol.ApiKeys apiKey, org.apache.kafka.common.message.RequestHeaderData header, org.apache.kafka.common.protocol.ApiMessage request, FilterContext context) Deprecated, for removal: This API element is subject to removal in a future version.default booleanshouldHandleRequest(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion) Does this filter implementation want to handle a request.
-
Method Details
-
shouldHandleRequest
default boolean shouldHandleRequest(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion) Does this filter implementation want to handle a request. If so, theonRequest(ApiKeys, short, RequestHeaderData, ApiMessage, FilterContext)method will be eligible to be called with the deserialized request data (if the message reaches this filter in the filter chain).- Parameters:
apiKey- the api key of the messageapiVersion- the api version of the message- Returns:
- true if this filter wants to handle the request
-
onRequest
@Deprecated(forRemoval=true, since="0.19.0") default CompletionStage<RequestFilterResult> onRequest(org.apache.kafka.common.protocol.ApiKeys apiKey, org.apache.kafka.common.message.RequestHeaderData header, org.apache.kafka.common.protocol.ApiMessage request, FilterContext context) Deprecated, for removal: This API element is subject to removal in a future version.implementonRequest(ApiKeys, short, RequestHeaderData, ApiMessage, FilterContext)instead.Handle the givenheaderandrequestpair, returning theheaderandrequestpair to be passed to the next filter using the RequestFilterResult.
The implementation may modify the givenheaderandrequestin-place, or instantiate a new instances.- Parameters:
apiKey- key of the requestheader- header of the requestrequest- body of the requestcontext- context containing methods to continue the filter chain and other contextual data- Returns:
- a non-null CompletionStage that, when complete, will yield a RequestFilterResult containing the request to be forwarded.
- See Also:
-
onRequest
default CompletionStage<RequestFilterResult> onRequest(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion, org.apache.kafka.common.message.RequestHeaderData header, org.apache.kafka.common.protocol.ApiMessage request, FilterContext context) Handle the givenheaderandrequestpair, returning theheaderandrequestpair to be passed to the next filter using the RequestFilterResult.
The implementation may modify the givenheaderandrequestin-place, or instantiate a new instances.- Parameters:
apiKey- key of the requestapiVersion- api version of the requestheader- header of the requestrequest- body of the requestcontext- context containing methods to continue the filter chain and other contextual data- Returns:
- a non-null CompletionStage that, when complete, will yield a RequestFilterResult containing the request to be forwarded.
- See Also:
-
onRequest(ApiKeys, short, RequestHeaderData, ApiMessage, FilterContext)instead.