Annotation Type Subscribe


@Retention(RUNTIME) @Target(METHOD) public @interface Subscribe
An annotation that indicates that this method can be used to listen for an event from the proxy.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Whether the handler must be called asynchronously.
    The order events will be posted to this listener.
  • Element Details

    • order

      PostOrder order
      The order events will be posted to this listener.
      Returns:
      the order
      Default:
      NORMAL
    • async

      boolean async
      Whether the handler must be called asynchronously.

      This option currently has no effect, but in the future it will. In Velocity 3.0.0, all event handlers run asynchronously by default. You are encouraged to determine whether or not to enable it now. This option is being provided as a migration aid.

      If this method returns true, the method is guaranteed to be executed asynchronously. Otherwise, the handler may be executed on the current thread or asynchronously. This still means you must consider thread-safety in your event listeners as the "current thread" can and will be different each time.

      If any method handler targeting an event type is marked with true, then every handler targeting that event type will be executed asynchronously.

      Returns:
      Requires async
      Default:
      true