org.axonframework.eventhandling.annotation
Class AnnotationTransactionManager

java.lang.Object
  extended by org.axonframework.eventhandling.annotation.AnnotationTransactionManager
All Implemented Interfaces:
TransactionManager

public class AnnotationTransactionManager
extends Object
implements TransactionManager

A transaction manager that delegates calls to the appropriate annotated methods in a bean. These methods need to be annotated with BeforeTransaction and AfterTransaction and may have one parameter: TransactionStatus.

Since:
0.5
Author:
Allard Buijze

Constructor Summary
AnnotationTransactionManager(Object bean)
          Initialize a transaction manager that delegates calls tot he given bean.
 
Method Summary
 void afterTransaction(TransactionStatus transactionStatus)
          Invoked by the EventProcessingScheduler after a series of events is processed.
 void beforeTransaction(TransactionStatus transactionStatus)
          Invoked by the EventProcessingScheduler before processing a series of events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationTransactionManager

public AnnotationTransactionManager(Object bean)
Initialize a transaction manager that delegates calls tot he given bean.

Parameters:
bean - The bean containing annotation transaction management methods
Method Detail

beforeTransaction

public void beforeTransaction(TransactionStatus transactionStatus)
Invoked by the EventProcessingScheduler before processing a series of events. The given TransactionStatus may be used to set the maximum batch size for the current transaction.

Specified by:
beforeTransaction in interface TransactionManager
Parameters:
transactionStatus - The current status of the transaction
See Also:
TransactionManager.afterTransaction(TransactionStatus), TransactionStatus

afterTransaction

public void afterTransaction(TransactionStatus transactionStatus)
Invoked by the EventProcessingScheduler after a series of events is processed. The given TransactionStatus may be used to indicate whether the scheduler should yield to other event processing schedulers or not.

This method is always called once for each invocation to TransactionManager.beforeTransaction(TransactionStatus), even if no events were processed at all.

Note that this method is called when a transactional batch was handled successfully, as well as when an error occurred. Use the TransactionStatus object to find information about transaction status and (when failed) the cause of the failure.

Specified by:
afterTransaction in interface TransactionManager
Parameters:
transactionStatus - The current status of the transaction
See Also:
TransactionManager.beforeTransaction(TransactionStatus), TransactionStatus


Copyright © 2011. All Rights Reserved.