@EventHandler. The declared parameters of the method define which events it will receive.
@EventHandlerannotation. When specified, the first parameter is resolved using the rules specified below. Do not configure the payload type on the annotation if you want the payload to be passed as a parameter.
@MetaDataValuewill resolve to the Meta Data value with the key as indicated on the annotation. If
nullis passed when the meta data value is not present. If
true, the resolver will not match and prevent the method from being invoked when the meta data value is not present.
MetaDatawill have the entire
@Timestampand of type
java.time.temporal.Temporal) will resolve to the timestamp of the
EventMessage. This is the time at which the Event was generated.
@SequenceNumberand of type
longwill resolve to the
DomainEventMessage. This provides the order in which the Event was generated (within the scope of the Aggregate it originated from).
EventMessageinjected (if the message is assignable to that parameter). If the first parameter is of type message, it effectively matches an Event of any type, even if generic parameters would suggest otherwise. Due to type erasure, Axon cannot detect what parameter is expected. In such case, it is best to declare a parameter of the payload type, followed by a parameter of type Message.
@Configurationfile), any other parameters will resolve to autowired beans, if exactly one injectable candidate is available in the application context. This allows you to inject resources directly into
ParameterResolvers by implementing the
ParameterResolverFactoryinterface and creating a file named
/META-INF/service/org.axonframework.common.annotation.ParameterResolverFactorycontaining the fully qualified name of the implementing class. See Advanced Customizations for details.
this.getClass()), all annotated methods are evaluated
SubListenerwill be invoked for all instances of
EventBas well as
EventC(as it extends
EventB). In other words, the handler methods of
TopListenerwill not receive any invocations for
EventCat all. Since
EventAis not assignable to
EventB(it's its superclass), those will be processed by the handler method in
EventHandlingConfigurationclass, which is registered as a module with the global Axon
Configurer. Typically, an application will have a single
EventHandlingConfigurationdefined, but larger more modular applications may choose to define one per module.
@EventHandlermethods, use the
registerEventHandlermethod on the