Interface CommandHandler.ForCommand<I,C extends Command,R>

Type Parameters:
I - the generic type of the instance to be event sourced before handling the command
C - the command type
R - the command execution result type
All Superinterfaces:
CommandHandler<I,C,R>
Enclosing interface:
CommandHandler<I,C extends Command,R>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static non-sealed interface CommandHandler.ForCommand<I,C extends Command,R> extends CommandHandler<I,C,R>
FunctionalInterface to be implemented, if only the Command is needed for execution. This is typically used for Command.SubjectCondition.PRISTINE commands, for which no instance state is available. However, the usage of this interface does not imply pristine semantics. Make sure to implement your Command accordingly, if needed.
  • Method Details

    • handle

      R handle(C command, CommandEventPublisher<I> commandEventPublisher)
      Handles the given command without having access to the event-sourced instance representing the current state (aka write model). The given CommandEventPublisher enables the publication of new events upon successful command execution.
      Parameters:
      command - the command payload to be executed
      commandEventPublisher - a callback to publish new events
      Returns:
      a generic command execution result, may be null