Module org.fuin.cqrs4j
Package org.fuin.cqrs4j
Interface CommandExecutor<CONTEXT,RESULT,CMD extends Command>
- Type Parameters:
CONTEXT- Type of context for the command execution.RESULT- Result of the command execution.CMD- Type of command to execute.
- All Known Implementing Classes:
AbstractMultiCommandExecutor,MultiCommandExecutor
public interface CommandExecutor<CONTEXT,RESULT,CMD extends Command>
Executes one or more commands.
-
Method Summary
-
Method Details
-
getCommandTypes
Returns a list of commands this executor can handle.- Returns:
- List of unique command types.
-
execute
RESULT execute(@NotNull CONTEXT ctx, @NotNull CMD cmd) throws org.fuin.ddd4j.ddd.AggregateVersionConflictException, org.fuin.ddd4j.ddd.AggregateNotFoundException, org.fuin.ddd4j.ddd.AggregateVersionNotFoundException, org.fuin.ddd4j.ddd.AggregateDeletedException, org.fuin.ddd4j.ddd.AggregateAlreadyExistsException, CommandExecutionFailedException Executes the given command. Only the main aggregate related exceptions are modeled via throws. All other checked exceptions must be wrapped into aCommandExecutionFailedException.- Parameters:
ctx- Context of the execute.cmd- Command to execute.- Returns:
- Result.
- Throws:
org.fuin.ddd4j.ddd.AggregateVersionConflictException- There is a conflict between an expected and an actual version for the aggregate targeted by the command.org.fuin.ddd4j.ddd.AggregateNotFoundException- The aggregate targeted by the command with a given type and identifier was not found in the repository.org.fuin.ddd4j.ddd.AggregateVersionNotFoundException- The requested version for the aggregate targeted by the command does not exist.org.fuin.ddd4j.ddd.AggregateDeletedException- The aggregate targeted by the command was deleted from the repository.org.fuin.ddd4j.ddd.AggregateAlreadyExistsException- The aggregate targeted by the command already exists when trying to create it.CommandExecutionFailedException- Other checked exceptions are wrapped into this one.
-