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:

For each event, only a single annotated method will be invoked. This method is resolved in the following order

  1. First, the event handler methods of the actual class (at runtime) are searched
  2. If a method is found with a parameter that the domain event can be assigned to, it is marked as eligible
  3. 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
  4. If no method is found in the actual class, its super class is evaluated.
  5. 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.
 
Optional Element Summary
 String keyName
          The key in the AssociationValue to use.
 Class<?> payloadType
          The type of event this method handles.
 

Element Detail

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.