org.axonframework.saga.annotation
Annotation Type SagaEventHandler
@Documented
@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface SagaEventHandler
Method-level annotation indicating that the annotated method i an event handler method for the saga instance.
Annotated methods must comply to a few simple rules: - The method must accept 1 parameter: a subtype of
EventMessage
- Return values are allowed, but are ignored
- Exceptions are highly
discouraged,
and are likely to be caught and ignored by the dispatchers
For each event, only a single annotated method will be invoked. This method is resolved in the following order
- First, the event handler methods of the actual class (at runtime) are searched
- If a method is found with a
parameter that the domain event can be assigned to, it is marked as eligible
- After a class has been evaluated
(but before any super class), the most specific event handler method is called. That means that if an event handler
for a class A and one for a class B are eligible, and B is a subclass of A, then the method with a parameter of type
B will be chosen
- If no method is found in the actual class, its super class is evaluated.
- If still no method
is found, the event listener ignores the event
- Since:
- 0.7
- Author:
- Allard Buijze
- See Also:
EventHandler
Required Element Summary |
String |
associationProperty
The property in the event that will provide the value to find the Saga instance. |
associationProperty
public abstract String associationProperty
- The property in the event that will provide the value to find the Saga instance. Typically, this value is an
aggregate identifier of an aggregate that a specific saga monitors.
keyName
public abstract String keyName
- The key in the AssociationValue to use. Optional. Should only be configured if that property is different than
the value given by
associationProperty()
.
- Default:
- ""
payloadType
public abstract Class<?> payloadType
- The type of event this method handles. If specified, this handler will only be invoked for message that have a
payload assignable to the given payload type. If unspecified, the first parameter of the method defines the type
of supported event.
- Default:
- java.lang.Void.class
Copyright © 2010-2016. All Rights Reserved.