Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright (c) 2011. Axon Framework
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
package org.axonframework.saga.annotation;
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 org.axonframework.domain.Event
  • 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

  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

Allard Buijze
See also:
public @interface SagaEventHandler {

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.
    String associationProperty();

The key in the AssociationValue to use. Optional. Should only be configured if that property is different than the value given by associationProperty().
    String keyName() default "";
New to GrepCode? Check out our FAQ X