Interface CommandChannel
-
- All Known Implementing Classes:
CommandChannelImpl
public interface CommandChannelCommunication channel with AxonServer for Command related interactions.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CompletableFuture<Void>prepareDisconnect()Prepares thisCommandChannelto disconnect, by unsubscribing all registered command handlers.RegistrationregisterCommandHandler(Function<Command,CompletableFuture<CommandResponse>> handler, int loadFactor, String... commandNames)Registers the givenhandlerto handle incoming commands with givencommandNames, using the givenloadFactor.CompletableFuture<CommandResponse>sendCommand(Command command)Sends the give Command to AxonServer for routing to an appropriate handler.
-
-
-
Method Detail
-
registerCommandHandler
Registration registerCommandHandler(Function<Command,CompletableFuture<CommandResponse>> handler, int loadFactor, String... commandNames)
Registers the givenhandlerto handle incoming commands with givencommandNames, using the givenloadFactor. 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 withloadFactor- the relative load factor for this handlercommandNames- 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 thisCommandChannelto 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
CompletableFutureofVoidto react when all command handlers have been unsubscribed
-
-