org.axonframework.eventhandling.transactionmanagers
Class SpringTransactionManager

java.lang.Object
  extended by org.axonframework.eventhandling.transactionmanagers.SpringTransactionManager
All Implemented Interfaces:
TransactionManager

public class SpringTransactionManager
extends Object
implements TransactionManager

TransactionManager implementation that uses a PlatformTransactionManager as underlying transaction manager.

The transaction manager will commit the transaction when event handling is successful. If a non-transient (non-recoverable) exception occurs, the failing event is discarded and the transaction is committed. If a transient exception occurs, such as a failing connection, the transaction is rolled back and scheduled for a retry.

Since:
0.5
Author:
Allard Buijze

Constructor Summary
SpringTransactionManager()
           
 
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.
 void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
          The PlatformTransactionManager that manages the transactions with the underlying data source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringTransactionManager

public SpringTransactionManager()
Method Detail

beforeTransaction

public void beforeTransaction(TransactionStatus transactionStatus)
Description copied from interface: TransactionManager
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)
Description copied from interface: TransactionManager
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

setTransactionManager

public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
The PlatformTransactionManager that manages the transactions with the underlying data source.

Parameters:
transactionManager - the transaction manager that manages transactions with underlying data sources


Copyright © 2011. All Rights Reserved.