org.axonframework.eventhandling.annotation
Annotation Type AfterTransaction


@Documented
@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface AfterTransaction

Annotation that marks a method to be called after a transactional batch of events is being handled. This gives the annotated method the opportunity to clean up resources and commit or rollback transactions.

Methods annotated by this annotation may have zero or one parameter of type TransactionStatus. The transaction status object contains information about the last transaction.

Note that this method is both called when a transactional batch was successfully handled, or when an exception occurred during the batch process. In that case, the TransactionStatus will contain information about the failure.

The AfterTransaction method is called once for every call to a BeforeTransaction method, regardless of the outcome of a transaction.

For each class hierarchy, only a single method annotated with @AfterTransaction will be invoked. This is always a method on the most specific class (i.e. subclass) in the hierarchy. If that class contains several annotated methods, the behavior is undefined.

Since:
0.3
Author:
Allard Buijze
See Also:
TransactionStatus.isSuccessful(), TransactionStatus.getException()



Copyright © 2011. All Rights Reserved.