Interface RemoteCommandDispatcher

All Known Implementing Classes:
HttpRemoteCommandDispatcher

public interface RemoteCommandDispatcher
Sends a command to another member of the cluster and reports back the outcome of handling it there.

The distinction this contract has to preserve is between a member that could not be reached and a handler that ran and failed. Only the former says anything about the member's availability, and the connector uses that to decide whether to take the member out of its routing ring, so an unreachable member must be reported as a CommandDispatchException while a failed handler must not.

HttpRemoteCommandDispatcher is the implementation used in practice. This contract is separate from it so that the connector's routing can be exercised without a web stack, and so that a different transport can be put underneath without touching the connector.

Since:
5.4.0
Author:
Allard Buijze
  • Method Details

    • dispatch

      CompletableFuture<@Nullable CommandResultMessage> dispatch(Member member, CommandMessage command)
      Sends the given command to the given member and completes with the outcome of handling it there.
      Parameters:
      member - the member to send the command to. Never local
      command - the command to send
      Returns:
      a future completing with the result of handling the command on the given member, with null when its handler returned none; completing exceptionally with a CommandDispatchException when the member could not be reached, and with the handler's own failure when it ran and failed