Annotation Interface EventHandling
EventHandlerDefinition
Beans. It can be placed on public void methods with at least
one of the following unique parameter types, in any order:
- any non-primitive class extending
Object(includingObjectitself) representing an assignableEventHandlerDefinition.eventClass() - a
java.util.Map<String, ?>for the event meta-data - an
Eventfor the raw event - any number of
Autowiredannotated parameters, resolving to single beans within theApplicationContext
EventHandlerDefinition.eventClass(), i.e.
only meta-data and/or raw event, Object is used as EventHandlerDefinition.eventClass(). Hence, any
such method will consume all available events.
Methods annotated using this may declare (and throw) any Throwable. As defined by
EventHandlingProcessor.run() all exceptions except CqrsFrameworkException.NonTransientException will
be retried automatically, if configured accordingly.
The method must be contained within an
AnnotatedBeanDefinition, for instance within
Components or Configurations.
EventHandling annotated methods may optionally be annotated with
Transactional to enforce Spring transaction semantics for event
handlers. Be aware, that these are applied per single event handling method call.
Omitting Transactional annotation does not
imply, that no transaction will be active while executing the EventHandler. For instance, using
JdbcProgressTracker will automatically make the handler participate in the same transaction.
This annotation may also be used within meta annotations, typically to avoid duplication of the group()
for multiple methods.
- See Also:
-
Optional Element Summary
Optional Elements
-
Element Details
-
value
Alias forgroup().- Returns:
- the group identifier
- Default:
""
-
group
Specifies theEventHandlerDefinition.group()for the annotated method.- Returns:
- the group identifier
- Default:
""
-