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.
| Constructor and Description | 
|---|
CachingEventSourcingRepository(AggregateFactory<T> aggregateFactory,
                              EventStore eventStore,
                              Cache cache)
Initializes a repository with a the given  
aggregateFactory and a pessimistic locking strategy. | 
CachingEventSourcingRepository(AggregateFactory<T> aggregateFactory,
                              EventStore eventStore,
                              Cache cache,
                              RepositoryProvider repositoryProvider)
Initializes a repository with a the given  
aggregateFactory and a pessimistic locking strategy. | 
CachingEventSourcingRepository(AggregateFactory<T> aggregateFactory,
                              EventStore eventStore,
                              Cache cache,
                              SnapshotTriggerDefinition snapshotTriggerDefinition)
Initializes a repository with a the given  
aggregateFactory and a pessimistic locking strategy. | 
CachingEventSourcingRepository(AggregateFactory<T> aggregateFactory,
                              EventStore eventStore,
                              Cache cache,
                              SnapshotTriggerDefinition snapshotTriggerDefinition,
                              RepositoryProvider repositoryProvider)
Initializes a repository with a the given  
aggregateFactory and a pessimistic locking strategy. | 
CachingEventSourcingRepository(AggregateFactory<T> aggregateFactory,
                              EventStore eventStore,
                              LockFactory lockFactory,
                              Cache cache,
                              ParameterResolverFactory parameterResolverFactory,
                              HandlerDefinition handlerDefinition,
                              SnapshotTriggerDefinition snapshotTriggerDefinition,
                              RepositoryProvider repositoryProvider)
Initializes a repository with a the given  
aggregateFactory and a pessimistic locking strategy. | 
CachingEventSourcingRepository(AggregateFactory<T> aggregateFactory,
                              EventStore eventStore,
                              LockFactory lockFactory,
                              Cache cache,
                              ParameterResolverFactory parameterResolverFactory,
                              SnapshotTriggerDefinition snapshotTriggerDefinition)
Initializes a repository with a the given  
aggregateFactory and a pessimistic locking strategy. | 
CachingEventSourcingRepository(AggregateFactory<T> aggregateFactory,
                              EventStore eventStore,
                              LockFactory lockFactory,
                              Cache cache,
                              SnapshotTriggerDefinition snapshotTriggerDefinition)
Initializes a repository with a the given  
aggregateFactory and a pessimistic locking strategy. | 
CachingEventSourcingRepository(AggregateFactory<T> aggregateFactory,
                              EventStore eventStore,
                              LockFactory lockFactory,
                              Cache cache,
                              SnapshotTriggerDefinition snapshotTriggerDefinition,
                              RepositoryProvider repositoryProvider)
Initializes a repository with a the given  
aggregateFactory and a pessimistic locking strategy. | 
| Modifier and Type | Method and Description | 
|---|---|
protected EventSourcedAggregate<T> | 
doCreateNewForLock(Callable<T> factoryMethod)
Creates a new aggregate instance using the given  
factoryMethod. | 
protected void | 
doDeleteWithLock(EventSourcedAggregate<T> aggregate)
Perform the actual deleting of the aggregate. 
 | 
protected EventSourcedAggregate<T> | 
doLoadWithLock(String aggregateIdentifier,
              Long expectedVersion)
Perform the actual loading of an aggregate. 
 | 
protected void | 
doSaveWithLock(EventSourcedAggregate<T> aggregate)
Perform the actual saving of the aggregate. 
 | 
protected void | 
validateOnLoad(Aggregate<T> aggregate,
              Long expectedVersion)
Checks the aggregate for concurrent changes. 
 | 
getAggregateFactory, readEvents, reportIllegalStatedoCreateNew, doDelete, doLoad, doSave, prepareForCommitaggregateModel, canResolve, getAggregateType, load, load, managedAggregates, newInstance, postDelete, postSave, sendpublic CachingEventSourcingRepository(AggregateFactory<T> aggregateFactory, EventStore eventStore, Cache cache)
aggregateFactory and a pessimistic locking strategy. It stores
 Aggregates in the given cache.
 A repository initialized using this constructor does not create snapshots for aggregates.
aggregateFactory - The factory for new aggregate instanceseventStore - The event store that holds the event streams for this repositorycache - The cache in which entries will be storedLockingRepository.LockingRepository(Class)public CachingEventSourcingRepository(AggregateFactory<T> aggregateFactory, EventStore eventStore, Cache cache, RepositoryProvider repositoryProvider)
aggregateFactory and a pessimistic locking strategy. It stores
 Aggregates in the given cache.
 A repository initialized using this constructor does not create snapshots for aggregates.
aggregateFactory - The factory for new aggregate instanceseventStore - The event store that holds the event streams for this repositorycache - The cache in which entries will be storedrepositoryProvider - Provides repositories for specific aggregate typesLockingRepository.LockingRepository(Class)public CachingEventSourcingRepository(AggregateFactory<T> aggregateFactory, EventStore eventStore, Cache cache, SnapshotTriggerDefinition snapshotTriggerDefinition)
aggregateFactory and a pessimistic locking strategy.aggregateFactory - The factory for new aggregate instanceseventStore - The event store that holds the event streams for this repositorycache - The cache in which entries will be storedsnapshotTriggerDefinition - The definition describing when to trigger a snapshotLockingRepository.LockingRepository(Class)public CachingEventSourcingRepository(AggregateFactory<T> aggregateFactory, EventStore eventStore, Cache cache, SnapshotTriggerDefinition snapshotTriggerDefinition, RepositoryProvider repositoryProvider)
aggregateFactory and a pessimistic locking strategy.aggregateFactory - The factory for new aggregate instanceseventStore - The event store that holds the event streams for this repositorycache - The cache in which entries will be storedsnapshotTriggerDefinition - The definition describing when to trigger a snapshotrepositoryProvider - Provides repositories for specific aggregate typesLockingRepository.LockingRepository(Class)public CachingEventSourcingRepository(AggregateFactory<T> aggregateFactory, EventStore eventStore, LockFactory lockFactory, Cache cache, SnapshotTriggerDefinition snapshotTriggerDefinition)
aggregateFactory and a pessimistic locking strategy.
 Note that an optimistic locking strategy is not compatible with caching.
aggregateFactory - The factory for new aggregate instanceseventStore - The event store that holds the event streams for this repositorylockFactory - The lock factory restricting concurrent access to aggregate instancescache - The cache in which entries will be storedsnapshotTriggerDefinition - The definition describing when to trigger a snapshotLockingRepository.LockingRepository(Class)public CachingEventSourcingRepository(AggregateFactory<T> aggregateFactory, EventStore eventStore, LockFactory lockFactory, Cache cache, SnapshotTriggerDefinition snapshotTriggerDefinition, RepositoryProvider repositoryProvider)
aggregateFactory and a pessimistic locking strategy.
 Note that an optimistic locking strategy is not compatible with caching.
aggregateFactory - The factory for new aggregate instanceseventStore - The event store that holds the event streams for this repositorylockFactory - The lock factory restricting concurrent access to aggregate instancescache - The cache in which entries will be storedsnapshotTriggerDefinition - The definition describing when to trigger a snapshotrepositoryProvider - Provides repositories for specific aggregate typesLockingRepository.LockingRepository(Class)public CachingEventSourcingRepository(AggregateFactory<T> aggregateFactory, EventStore eventStore, LockFactory lockFactory, Cache cache, ParameterResolverFactory parameterResolverFactory, SnapshotTriggerDefinition snapshotTriggerDefinition)
aggregateFactory and a pessimistic locking strategy.
 Note that an optimistic locking strategy is not compatible with caching.
aggregateFactory - The factory for new aggregate instanceseventStore - The event store that holds the event streams for this repositorylockFactory - The lock factory restricting concurrent access to aggregate instancescache - The cache in which entries will be storedparameterResolverFactory - The parameter resolver factory used to resolve parameters of annotated handlerssnapshotTriggerDefinition - The definition describing when to trigger a snapshotLockingRepository.LockingRepository(Class)public CachingEventSourcingRepository(AggregateFactory<T> aggregateFactory, EventStore eventStore, LockFactory lockFactory, Cache cache, ParameterResolverFactory parameterResolverFactory, HandlerDefinition handlerDefinition, SnapshotTriggerDefinition snapshotTriggerDefinition, RepositoryProvider repositoryProvider)
aggregateFactory and a pessimistic locking strategy.
 Note that an optimistic locking strategy is not compatible with caching.
aggregateFactory - The factory for new aggregate instanceseventStore - The event store that holds the event streams for this repositorylockFactory - The lock factory restricting concurrent access to aggregate instancescache - The cache in which entries will be storedparameterResolverFactory - The parameter resolver factory used to resolve parameters of annotated handlershandlerDefinition - The handler definition used to create concrete handlerssnapshotTriggerDefinition - The definition describing when to trigger a snapshotrepositoryProvider - Provides repositories for specific aggregate typesLockingRepository.LockingRepository(Class)protected void validateOnLoad(Aggregate<T> aggregate, Long expectedVersion)
AbstractRepositoryConflictingModificationException when 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
validateOnLoad in class EventSourcingRepository<T>aggregate - The loaded aggregateexpectedVersion - The expected version of the aggregateprotected EventSourcedAggregate<T> doCreateNewForLock(Callable<T> factoryMethod) throws Exception
LockingRepositoryfactoryMethod. Implementations should assume that this
 method is only called if a UnitOfWork is currently active.doCreateNewForLock in class EventSourcingRepository<T>factoryMethod - The method to create the aggregate's root instanceException - when the factoryMethod throws an exceptionprotected void doSaveWithLock(EventSourcedAggregate<T> aggregate)
LockingRepositorydoSaveWithLock in class EventSourcingRepository<T>aggregate - the aggregate to storeprotected void doDeleteWithLock(EventSourcedAggregate<T> aggregate)
LockingRepositorydoDeleteWithLock in class EventSourcingRepository<T>aggregate - the aggregate to deleteprotected 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–2018. All rights reserved.