T - The type of aggregate this repository storespublic 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.
EventSourcingRepository.Builder<T>| Modifier | Constructor and Description |
|---|---|
protected |
CachingEventSourcingRepository(EventSourcingRepository.Builder<T> builder)
Instantiate a
CachingEventSourcingRepository based on the fields contained in the
EventSourcingRepository.Builder. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doDeleteWithLock(EventSourcedAggregate<T> aggregate) |
protected EventSourcedAggregate<T> |
doLoadWithLock(String aggregateIdentifier,
Long expectedVersion)
Perform the actual loading of an aggregate.
|
protected void |
doSaveWithLock(EventSourcedAggregate<T> aggregate) |
protected void |
validateOnLoad(org.axonframework.modelling.command.Aggregate<T> aggregate,
Long expectedVersion) |
builder, doCreateNewForLock, getAggregateFactory, readEvents, reportIllegalStatedoCreateNew, doDelete, doLoad, doLoadOrCreate, doSave, prepareForCommitprotected CachingEventSourcingRepository(EventSourcingRepository.Builder<T> builder)
CachingEventSourcingRepository based on the fields contained in the
EventSourcingRepository.Builder.
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.
Additionally will assert that the LockFactory, EventStore, SnapshotTriggerDefinition and
Cache are not null, resulting in an AxonConfigurationException if for any of these this is the
case.
builder - the EventSourcingRepository.Builder used to instantiate a
CachingEventSourcingRepository instanceprotected void validateOnLoad(org.axonframework.modelling.command.Aggregate<T> aggregate, Long expectedVersion)
validateOnLoad in class EventSourcingRepository<T>protected void doSaveWithLock(EventSourcedAggregate<T> aggregate)
doSaveWithLock in class EventSourcingRepository<T>protected void doDeleteWithLock(EventSourcedAggregate<T> aggregate)
doDeleteWithLock in class EventSourcingRepository<T>protected EventSourcedAggregate<T> doLoadWithLock(String aggregateIdentifier, Long expectedVersion)
doLoadWithLock in class EventSourcingRepository<T>aggregateIdentifier - the identifier of the aggregate to loadexpectedVersion - The expected version of the aggregateCopyright © 2010–2024. All rights reserved.