org.axonframework.eventsourcing
Class SpringAggregateSnapshotter
java.lang.Object
org.axonframework.eventsourcing.AbstractSnapshotter
org.axonframework.eventsourcing.AggregateSnapshotter
org.axonframework.eventsourcing.SpringAggregateSnapshotter
- All Implemented Interfaces:
- Snapshotter, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle
public class SpringAggregateSnapshotter
- extends AggregateSnapshotter
- implements org.springframework.context.ApplicationContextAware, org.springframework.context.SmartLifecycle
Implementation of the AggregateSnapshotter
that eases the configuration when
used within a Spring Application Context. It will automatically detect a Transaction Manager and Aggregate
Factories.
The only mandatory properties to set is AbstractSnapshotter.setEventStore(org.axonframework.eventstore.SnapshotEventStore)
. In
most cases, you should also provide an executor, as the default will execute snapshotter tasks in the calling
thread.
- Since:
- 0.6
- Author:
- Allard Buijze
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SpringAggregateSnapshotter
public SpringAggregateSnapshotter()
setTransactionManager
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
- Sets the transaction manager to manager underlying transaction with. If none is provided, an attempt is made to
auto detect is from the application context. If a single transaction manager is found, it is used to manage
transactions. Of none or more than one is found, they are ignored.
- Parameters:
transactionManager
- the transaction manager managing underlying transactions
setTransactionDefinition
public void setTransactionDefinition(org.springframework.transaction.TransactionDefinition transactionDefinition)
- Optionally sets the transaction definition to use. By default, uses the application context's default
transaction semantics (see
DefaultTransactionDefinition
).
- Parameters:
transactionDefinition
- the transaction definition to use
setAggregateFactories
public void setAggregateFactories(List<AggregateFactory<?>> aggregateFactories)
- Optionally sets the aggregate factories to use. By default, this implementation will auto detect available
factories from the application context. Configuring them using this method will prevent auto detection.
- Overrides:
setAggregateFactories
in class AggregateSnapshotter
- Parameters:
aggregateFactories
- The list of aggregate factories creating the aggregates to store.
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
- Specified by:
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
isAutoStartup
public boolean isAutoStartup()
- Specified by:
isAutoStartup
in interface org.springframework.context.SmartLifecycle
stop
public void stop(Runnable runnable)
- Specified by:
stop
in interface org.springframework.context.SmartLifecycle
start
public void start()
- Specified by:
start
in interface org.springframework.context.Lifecycle
stop
public void stop()
- Specified by:
stop
in interface org.springframework.context.Lifecycle
isRunning
public boolean isRunning()
- Specified by:
isRunning
in interface org.springframework.context.Lifecycle
getPhase
public int getPhase()
- Specified by:
getPhase
in interface org.springframework.context.Phased
Copyright © 2010-2016. All Rights Reserved.