T- The type of aggregate this repository stores
public class CachingEventSourcingRepository<T> extends EventSourcingRepository<T>
Note that an entry of a cached aggregate is immediately invalidated when an error occurs while saving that aggregate. This is done to prevent the cache from returning aggregates that may not have fully persisted to disk.
|Modifier||Constructor and Description|
|Modifier and Type||Method and Description|
Creates a new aggregate instance using the given
Perform the actual deleting of the aggregate.
Perform the actual loading of an aggregate.
Perform the actual saving of the aggregate.
Checks the aggregate for concurrent changes.
builder, getAggregateFactory, readEvents, reportIllegalState
doCreateNew, doDelete, doLoad, doLoadOrCreate, doSave, prepareForCommit
aggregateModel, canResolve, getAggregateType, load, load, loadOrCreate, managedAggregates, newInstance, postDelete, postSave, send
protected CachingEventSourcingRepository(EventSourcingRepository.Builder<T> builder)
CachingEventSourcingRepositorybased on the fields contained in the
A goal of the provided Builder is to create an
AggregateModel specifying generic
T as the
aggregate type to be stored. All aggregates in this repository must be
instanceOf this aggregate type.
To instantiate this AggregateModel, either an
AggregateModel can be provided directly or an
aggregateType of type
Class can be used. The latter will internally resolve to an
AggregateModel. Thus, either the AggregateModel or the
aggregateType should be provided. An
AxonConfigurationException is thrown if this criteria is not met.
The same criteria holds for the
AggregateFactory. Either the AggregateFactory can be set directly or it
will be instantiated internally based on the
aggregateType. Hence, one of both is a hard requirement, and
will also result in an AxonConfigurationException if both are missing.
ConflictingModificationExceptionwhen conflicting changes have been detected.
This implementation throws a
ConflictingAggregateVersionException if the expected version is not null
and the version number of the aggregate does not match the expected version
protected EventSourcedAggregate<T> doCreateNewForLock(Callable<T> factoryMethod) throws Exception
factoryMethod. Implementations should assume that this method is only called if a UnitOfWork is currently active.
protected void doSaveWithLock(EventSourcedAggregate<T> aggregate)
protected void doDeleteWithLock(EventSourcedAggregate<T> aggregate)
protected EventSourcedAggregate<T> doLoadWithLock(String aggregateIdentifier, Long expectedVersion)
Copyright © 2010–2020. All rights reserved.