Annotation Interface HandleEvent
MessageType.EVENT.
This annotation is used to designate methods that should be invoked when an event message is received.
It can be applied to instance methods or constructors. Constructors or static methods may be used for initializing stateful
handlers (see Stateful) in response to creation events.
Event handlers typically return void, as event processing is usually side-effect driven
and does not produce a result to be returned or published.
Example:
@HandleEvent
void on(UserCreated event) {
//do something with the event
}
A method with one unqualified
Graph<T> subscribes to every durable change of that model graph. Optional
Message and Metadata parameters may appear in any order.
The complete-change handler is invoked once per affected root and can inspect the complete before-state through
Graph.previous(). An explicit payload parameter, association-qualified Graph,
or second Graph keeps ordinary handler selection.
- See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<?>[]Restricts which payload types this handler may be invoked for.booleanIftrue, disables this handler during discovery.Determines how the handler responds when referenced protected data is no longer available.
-
Element Details
-
onMissingProtectedData
MissingProtectedDataPolicy onMissingProtectedDataDetermines how the handler responds when referenced protected data is no longer available.- Default:
DEFAULT
-
disabled
boolean disabledIftrue, disables this handler during discovery.- Default:
false
-
allowedClasses
Class<?>[] allowedClassesRestricts which payload types this handler may be invoked for.- Default:
{}
-