Annotation Interface Handler


Mark any method of any class(=listener) as a message handler and configure the handler using different properties.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Defines a filter condition as Expression Language.
    Define the mode in which a message is delivered to each listener.
    boolean
    Enable or disable the handler.
    Add any numbers of filters to the handler.
    Each handler call is implemented as an invocation object that implements the invocation mechanism.
    int
    Handlers are ordered by priority and handlers with higher priority are processed before those with lower priority, i.e.
    boolean
    Define whether or not the handler accepts sub types of the message type it declares in its signature.
  • Element Details

    • filters

      Filter[] filters
      Add any numbers of filters to the handler. All filters are evaluated before the handler is actually invoked, which is only if all the filters accept the message.
      Default:
      {}
    • condition

      String condition
      Defines a filter condition as Expression Language. This can be used to filter the events based on attributes of the event object. Note that the expression must resolve to either true to allow the event or false to block it from delivery to the handler. The message itself is available as "msg" variable.
      Returns:
      the condition in EL syntax.
      Default:
      ""
    • delivery

      Invoke delivery
      Define the mode in which a message is delivered to each listener. Listeners can be notified sequentially or concurrently.
      Default:
      Synchronously
    • priority

      int priority
      Handlers are ordered by priority and handlers with higher priority are processed before those with lower priority, i.e. Influence the order in which different handlers that consume the same message type are invoked.
      Default:
      0
    • rejectSubtypes

      boolean rejectSubtypes
      Define whether or not the handler accepts sub types of the message type it declares in its signature.
      Default:
      false
    • enabled

      boolean enabled
      Enable or disable the handler. Disabled handlers do not receive any messages. This property is useful for quick changes in configuration and necessary to disable handlers that have been declared by a superclass but do not apply to the subclass
      Default:
      true
    • invocation

      Class<? extends HandlerInvocation> invocation
      Each handler call is implemented as an invocation object that implements the invocation mechanism. The basic implementation uses reflection and is the default. It is possible though to provide a custom invocation to add additional logic. Note: Providing a custom invocation will most likely reduce performance, since the JIT-Compiler can not do some of its sophisticated byte code optimizations.
      Default:
      net.engio.mbassy.dispatch.ReflectiveHandlerInvocation.class