Annotation Interface LocalHandler
Annotation placed on types or methods of message handlers. If the annotation is present, messages are handled by the
handler immediately after publication (i.e. in the publishing thread).
This is akin to invoking a method on an injected service in traditional applications, but comes with all the benefits of location transparency.
Local handlers are often desirable for frequent queries or requests that require a response after the shortest possible latency.
Typically, though depending on MessageType and settings of LocalHandler, a locally handled message
will not be logged for consumption by non-local handlers.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanFlag that indicates whether this handler will handle external (non-local) messages as well as local messages.booleanEnables publication of locally handled messages.booleanEnables publication of handler metrics, likeHandleMessageEvents(if tracker monitoring is enabled).booleanEnables overriding the default behavior.
-
Element Details
-
value
boolean valueEnables overriding the default behavior. If a type is marked as local handler, a method can still be marked as non-local using annotation@LocalHandler(false).- Default:
- true
-
logMessage
boolean logMessageEnables publication of locally handled messages. Iftrue, messages and their payloads are logged as if they were not handled locally. This is often desirable for locally handled queries and commands issued by e.g. admins.- Default:
- false
-
logMetrics
boolean logMetricsEnables publication of handler metrics, likeHandleMessageEvents(if tracker monitoring is enabled).- Default:
- false
-
allowExternalMessages
boolean allowExternalMessagesFlag that indicates whether this handler will handle external (non-local) messages as well as local messages. The value of this flag is ignored ifvalue()is false.- Default:
- false
-