Package org.elasticsearch.transport
Class TransportActionProxy
- java.lang.Object
-
- org.elasticsearch.transport.TransportActionProxy
-
public final class TransportActionProxy extends java.lang.Object
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 Type Method Description static java.lang.String
getProxyAction(java.lang.String action)
Returns the corresponding proxy action for the given actionstatic boolean
isProxyAction(java.lang.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, java.lang.String action, 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, java.lang.String action, java.util.function.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 java.lang.String
unwrapAction(java.lang.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 Detail
-
registerProxyActionWithDynamicResponseType
public static void registerProxyActionWithDynamicResponseType(TransportService service, java.lang.String action, java.util.function.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, java.lang.String action, 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
public static java.lang.String getProxyAction(java.lang.String action)
Returns the corresponding proxy action for the given action
-
wrapRequest
public static TransportRequest wrapRequest(DiscoveryNode node, TransportRequest request)
Wraps the actual request in a proxy request object that encodes the target node.
-
unwrapRequest
public static TransportRequest unwrapRequest(TransportRequest request)
Unwraps a proxy request and returns the original request
-
unwrapAction
public static java.lang.String unwrapAction(java.lang.String action)
Unwraps a proxy action and returns the underlying action
-
isProxyAction
public static boolean isProxyAction(java.lang.String action)
Returnstrue
iff the given action is a proxy action
-
isProxyRequest
public static boolean isProxyRequest(TransportRequest request)
Returnstrue
iff the given request is a proxy request
-
-