org.axonframework.eventhandling.scheduling
Class SpringTransactionalTriggerCallback

java.lang.Object
  extended by org.axonframework.eventhandling.scheduling.SpringTransactionalTriggerCallback
All Implemented Interfaces:
EventTriggerCallback, org.springframework.beans.factory.InitializingBean

public class SpringTransactionalTriggerCallback
extends Object
implements EventTriggerCallback, org.springframework.beans.factory.InitializingBean

EventTriggerCallback implementation that starts a Spring-managed transaction prior to sending an event, and commits or rollbacks the transaction after publication success or failure, respectively.

Since:
1.1
Author:
Allard Buijze

Constructor Summary
SpringTransactionalTriggerCallback()
           
 
Method Summary
 void afterPropertiesSet()
           
 void afterPublicationFailure(RuntimeException cause)
          Invoked when the publication of a scheduled event failed.
 void afterPublicationSuccess()
          Invoked after the publication of a scheduled event has been executed successfully.
 void beforePublication(ApplicationEvent event)
          Invoked just before the given event is published.
 void setTransactionDefinition(org.springframework.transaction.TransactionDefinition transactionDefinition)
          Sets the TransactionDefinition to use when starting a transaction.
 void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
          Sets the PlatformTransactionManager that this callback uses to start and stop a transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringTransactionalTriggerCallback

public SpringTransactionalTriggerCallback()
Method Detail

beforePublication

public void beforePublication(ApplicationEvent event)
Description copied from interface: EventTriggerCallback
Invoked just before the given event is published.

Specified by:
beforePublication in interface EventTriggerCallback
Parameters:
event - The event about to be published

afterPublicationSuccess

public void afterPublicationSuccess()
Description copied from interface: EventTriggerCallback
Invoked after the publication of a scheduled event has been executed successfully.

Specified by:
afterPublicationSuccess in interface EventTriggerCallback

afterPublicationFailure

public void afterPublicationFailure(RuntimeException cause)
Description copied from interface: EventTriggerCallback
Invoked when the publication of a scheduled event failed.

Specified by:
afterPublicationFailure in interface EventTriggerCallback
Parameters:
cause - The cause of the failure

setTransactionManager

public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
Sets the PlatformTransactionManager that this callback uses to start and stop a transaction.

Parameters:
transactionManager - the PlatformTransactionManager that this callback uses to start and stop a transaction

setTransactionDefinition

public void setTransactionDefinition(org.springframework.transaction.TransactionDefinition transactionDefinition)
Sets the TransactionDefinition to use when starting a transaction. Defaults to a DefaultTransactionDefinition.

Parameters:
transactionDefinition - the TransactionDefinition to use when starting a transaction

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception


Copyright © 2011. All Rights Reserved.