Package org.elasticsearch.transport
Class TransportActionProxy
java.lang.Object
org.elasticsearch.transport.TransportActionProxy
TransportActionProxy allows an arbitrary action to be executed on a defined target node while the initial request is sent to a second
node that acts as a request proxy to the target node. This is useful if a node is not directly connected to a target node but is
connected to an intermediate node that establishes a transitive connection.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getProxyAction
(String action) Returns the corresponding proxy action for the given actionstatic boolean
isProxyAction
(String action) Returnstrue
iff the given action is a proxy actionstatic boolean
isProxyRequest
(TransportRequest request) Returnstrue
iff the given request is a proxy requeststatic void
registerProxyAction
(TransportService service, String action, boolean cancellable, Writeable.Reader<? extends TransportResponse> reader) Registers a proxy request handler that allows to forward requests for the given action to another node.static void
registerProxyActionWithDynamicResponseType
(TransportService service, String action, boolean cancellable, Function<TransportRequest, Writeable.Reader<? extends TransportResponse>> responseFunction) Registers a proxy request handler that allows to forward requests for the given action to another node.static String
unwrapAction
(String action) Unwraps a proxy action and returns the underlying actionstatic TransportRequest
unwrapRequest
(TransportRequest request) Unwraps a proxy request and returns the original requeststatic TransportRequest
wrapRequest
(DiscoveryNode node, TransportRequest request) Wraps the actual request in a proxy request object that encodes the target node.
-
Method Details
-
registerProxyActionWithDynamicResponseType
public static void registerProxyActionWithDynamicResponseType(TransportService service, String action, boolean cancellable, Function<TransportRequest, Writeable.Reader<? extends TransportResponse>> responseFunction) Registers a proxy request handler that allows to forward requests for the given action to another node. To be used when the response type changes based on the upcoming request (quite rare) -
registerProxyAction
public static void registerProxyAction(TransportService service, String action, boolean cancellable, Writeable.Reader<? extends TransportResponse> reader) Registers a proxy request handler that allows to forward requests for the given action to another node. To be used when the response type is always the same (most of the cases). -
getProxyAction
Returns the corresponding proxy action for the given action -
wrapRequest
Wraps the actual request in a proxy request object that encodes the target node. -
unwrapRequest
Unwraps a proxy request and returns the original request -
unwrapAction
Unwraps a proxy action and returns the underlying action -
isProxyAction
Returnstrue
iff the given action is a proxy action -
isProxyRequest
Returnstrue
iff the given request is a proxy request
-