Interface CommandChannel

  • All Known Implementing Classes:
    CommandChannelImpl

    public interface CommandChannel
    Communication channel with AxonServer for Command related interactions.
    • Method Detail

      • registerCommandHandler

        Registration registerCommandHandler​(Function<Command,​CompletableFuture<CommandResponse>> handler,
                                            int loadFactor,
                                            String... commandNames)
        Registers the given handler to handle incoming commands with given commandNames, using the given loadFactor. If handlers had already been registered for any of the given command names, this registration replaces the existing one for those command names. Other commands remain unaffected.
        Parameters:
        handler - the handler to handle incoming commands with
        loadFactor - the relative load factor for this handler
        commandNames - the names of the commands to register the handler for
        Returns:
        a registration which allows the command handler to be deregistered
      • sendCommand

        CompletableFuture<CommandResponse> sendCommand​(Command command)
        Sends the give Command to AxonServer for routing to an appropriate handler.
        Parameters:
        command - the command to send
        Returns:
        a CompletableFuture providing the result of command execution
      • prepareDisconnect

        CompletableFuture<Void> prepareDisconnect()
        Prepares this CommandChannel to disconnect, by unsubscribing all registered command handlers. Will wait with a certain cut off until all acknowledgments of unsubscribing have been received.

        This method should be used if a connected client wants to disconnect from AxonServer.

        Returns:
        a CompletableFuture of Void to react when all command handlers have been unsubscribed