Annotation Type CommandHandler


  • @Documented
    @Retention(RUNTIME)
    @Target({METHOD,ANNOTATION_TYPE,CONSTRUCTOR})
    public @interface CommandHandler
    Identifies a command handler in the context of CQRS, i.e. logic to process a Command. The command handler may or may not reject the command. In case of processing, the handler takes care of orchestrating the business logic related to the command.
    Since:
    1.1
    See Also:
    CQRS Documents by Greg Young - Commands
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String name
      Optional identification of the name of the command handled by this handler.
      java.lang.String namespace
      Optional identification of the namespace of the command handled by this handler.
    • Element Detail

      • namespace

        java.lang.String namespace
        Optional identification of the namespace of the command handled by this handler. This information may be used for easier linkage between command and handler by external tools and refers to Command.namespace(). When leaving the default value, it is assumed that the method signature makes clear what command is consumed. If the handler takes care of all commands of a specific namespace, the value of this field needs to be set to the respective namespace and the name() needs to be set accordingly. If the handler doesn't care about the namespace, the value may be set to the '*' (asterisk) placeholder.
        Default:
        ""
      • name

        java.lang.String name
        Optional identification of the name of the command handled by this handler. This information may be used for easier linkage between command and handler by external tools and refers to Command.name(). When leaving the default value, it is assumed that the method signature makes clear what command is consumed. If the handler takes care of all commands of a specific namespace, the value of this field needs to be set to the '*' (asterisk) placeholder.
        Default:
        ""