Record Class RequestResponseInvoker
- All Implemented Interfaces:
FilterInvoker
-
Constructor Summary
ConstructorsConstructorDescriptionRequestResponseInvoker(io.kroxylicious.proxy.filter.RequestFilter requestFilter, io.kroxylicious.proxy.filter.ResponseFilter responseFilter) Creates an instance of aRequestResponseInvokerrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()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.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.io.kroxylicious.proxy.filter.RequestFilterReturns the value of therequestFilterrecord component.io.kroxylicious.proxy.filter.ResponseFilterReturns the value of theresponseFilterrecord component.booleanshouldHandleRequest(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion) Should this Invoker handle a request with a given api key and api version.booleanshouldHandleResponse(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion) Should this Invoker handle a response with a given api key and api version.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
RequestResponseInvoker
public RequestResponseInvoker(io.kroxylicious.proxy.filter.RequestFilter requestFilter, io.kroxylicious.proxy.filter.ResponseFilter responseFilter) Creates an instance of aRequestResponseInvokerrecord class.- Parameters:
requestFilter- the value for therequestFilterrecord componentresponseFilter- the value for theresponseFilterrecord 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:FilterInvokerHandle 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
FilterContextis the factory forFilterResultobjects. SeeFilterContext.forwardRequest(RequestHeaderData, ApiMessage)andFilterContext.requestFilterResultBuilder()for more details.- Specified by:
onRequestin interfaceFilterInvoker- Parameters:
apiKey- the key of the messageapiVersion- the apiVersion of the messageheader- the header of the messagebody- the body of the messagefilterContext- 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.
-
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:FilterInvokerHandle 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
FilterContextis the factory forFilterResultobjects. SeeFilterContext.forwardResponse(ResponseHeaderData, ApiMessage)andFilterContext.responseFilterResultBuilder()for more details.- Specified by:
onResponsein interfaceFilterInvoker- Parameters:
apiKey- the key of the messageapiVersion- the apiVersion of the messageheader- the header of the messagebody- the body of the messagefilterContext- 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.
-
shouldHandleRequest
public boolean shouldHandleRequest(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion) Description copied from interface:FilterInvokerShould this Invoker handle a request with a given api key and api version. Returning true implies that this request will be deserialized andFilterInvoker.onRequest(ApiKeys, short, RequestHeaderData, ApiMessage, FilterContext)is eligible to be called with the deserialized data (if the message flows to that filter).- Specified by:
shouldHandleRequestin interfaceFilterInvoker- Parameters:
apiKey- the key of the messageapiVersion- the version of the message- Returns:
- true if the message should be deserialized
-
shouldHandleResponse
public boolean shouldHandleResponse(org.apache.kafka.common.protocol.ApiKeys apiKey, short apiVersion) Description copied from interface:FilterInvokerShould this Invoker handle a response with a given api key and api version. Returning true implies that this response will be deserialized andFilterInvoker.onResponse(ApiKeys, short, ResponseHeaderData, ApiMessage, FilterContext)is eligible to be called with the deserialized data (if the message flows to that filter).- Specified by:
shouldHandleResponsein interfaceFilterInvoker- Parameters:
apiKey- the key of the messageapiVersion- the version of the message- Returns:
- true if the message should be deserialized
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
requestFilter
public io.kroxylicious.proxy.filter.RequestFilter requestFilter()Returns the value of therequestFilterrecord component.- Returns:
- the value of the
requestFilterrecord component
-
responseFilter
public io.kroxylicious.proxy.filter.ResponseFilter responseFilter()Returns the value of theresponseFilterrecord component.- Returns:
- the value of the
responseFilterrecord component
-