@EventHandler @Documented @Retention(value=RUNTIME) @Target(value={METHOD,ANNOTATION_TYPE}) public @interface EventSourcingHandler
payloadType
parameter is
provided. In that case, the first parameter any other type of parameter described below.@MetaDataValue
will resolve to the Meta Data value with the key as indicated
on the annotation. If required is false (default), null is passed when the meta data value is not present. If
required is true, the resolver will not match and prevent the method from being invoked when the meta data value is
not present.MetaData
will have the entire Meta Data of an Event Message
injected.Instant
will resolve to the timestamp of the EventMessage. This is the
time at which the Event was generated.Message
will have the entire EventMessage
injected (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.<axon:annotation-config/>
is declared, any other parameters will
resolve to autowired beans, if exactly one autowire candidate is available in the application context. This allows
you to inject resources directly into @EventSourcingHandler
annotated methods.Object
.
Note: if there are two event handler methods accepting the same argument, the behavior is undefined.Modifier and Type | Optional Element and Description |
---|---|
Class<?> |
payloadType
The type of event this method handles.
|
public abstract Class<?> payloadType
Optional. If unspecified, the first parameter of the method defines the type of supported event.
Copyright © 2010–2024. All rights reserved.