Interface CommandHandler

  • All Known Implementing Classes:
    AnnotatedCommandHandler

    public interface CommandHandler
    Common interface for all Command message handlers
    A command handler can choose support to 1 or more command types
    See Also:
    AnnotatedCommandHandler
    • Method Detail

      • canHandle

        boolean canHandle​(Class<?> commandType)
        This method is called by the LocalCommandBus to check if this concrete CommandHandler supports a given command type
        Parameters:
        commandType - the type of command being processed by the LocalCommandBus
        Returns:
        true if this command handler can handle a command of the given type - otherwise it must return false
      • handle

        Object handle​(Object command)
        This method is called by the LocalCommandBus after it has determined that only this CommandHandler instance is capable of handling the command (based on the commands type)
        Parameters:
        command - the command
        Returns:
        the result of handling the command (if any)