Class TransportActionProxy

java.lang.Object
org.elasticsearch.transport.TransportActionProxy

public final class TransportActionProxy extends 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 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

      public static String getProxyAction(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 String unwrapAction(String action)
      Unwraps a proxy action and returns the underlying action
    • isProxyAction

      public static boolean isProxyAction(String action)
      Returns true iff the given action is a proxy action
    • isProxyRequest

      public static boolean isProxyRequest(TransportRequest request)
      Returns true iff the given request is a proxy request