Annotation Interface HandleSelf


@Documented @Target(METHOD) @Retention(RUNTIME) public @interface HandleSelf
Annotation placed on a method of a payload class of a request, i.e. command, query or web request. Upon publication of the request (i.e. in the publishing thread), the annotated method is invoked to handle the request.

Request like these don't require any other handler, though additional handlers may still handle the request. The advantage of this is that handler logic is contained within the payload class itself.

HandleSelf comes with the same advantages of local handlers.

See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Enables overriding the default behavior.
    boolean
    Enables publication of the handled message for other consumers.
    boolean
    Enables publication of handler metrics, like a HandleMessageEvent (if tracker monitoring is enabled).
    boolean
    If true, the result of the handler will be ignored.
  • Element Details

    • disabled

      boolean disabled
      Enables overriding the default behavior. If a supertype has a HandleSelf method, an overriding method can disable this using annotation @HandleSelf(disabled = true) or vice versa.
      Default:
      false
    • passive

      boolean passive
      If true, the result of the handler will be ignored.
      Default:
      false
    • logMessage

      boolean logMessage
      Enables publication of the handled message for other consumers. If true, messages and their payloads are logged as if they have not been handled yet. This is often desirable for self-handled queries and commands issued by e.g. admins.
      Default:
      false
    • logMetrics

      boolean logMetrics
      Enables publication of handler metrics, like a HandleMessageEvent (if tracker monitoring is enabled).
      Default:
      false