public class EventCountSnapshotterTrigger extends Object implements SnapshotterTrigger
Constructor and Description |
---|
EventCountSnapshotterTrigger() |
Modifier and Type | Method and Description |
---|---|
DomainEventStream |
decorateForAppend(String aggregateType,
EventSourcedAggregateRoot aggregate,
DomainEventStream eventStream)
Called when an event stream is appended to the event store.
|
DomainEventStream |
decorateForRead(String aggregateType,
Object aggregateIdentifier,
DomainEventStream eventStream)
Called when an event stream is read from the event store.
|
void |
setAggregateCache(Cache cache)
Sets the Cache instance used be Caching repositories.
|
void |
setAggregateCaches(List<Cache> caches)
Sets the Cache instances used be Caching repositories.
|
void |
setClearCountersAfterAppend(boolean clearCountersAfterAppend)
Indicates whether to maintain counters for aggregates after appending events to the event store for these
aggregates.
|
void |
setSnapshotter(Snapshotter snapshotter)
Sets the snapshotter to notify when a snapshot needs to be taken.
|
void |
setTrigger(int trigger)
Sets the number of events that will trigger the creation of a snapshot events.
|
public DomainEventStream decorateForRead(String aggregateType, Object aggregateIdentifier, DomainEventStream eventStream)
EventStreamDecorator
eventStream
and pass
that to the chain.decorateForRead
in interface EventStreamDecorator
aggregateType
- The type of aggregate events are being read foraggregateIdentifier
- The identifier of the aggregate events are loaded foreventStream
- The eventStream containing the events to append to the event storepublic DomainEventStream decorateForAppend(String aggregateType, EventSourcedAggregateRoot aggregate, DomainEventStream eventStream)
EventStreamDecorator
eventStream
and pass
that to the chain.decorateForAppend
in interface EventStreamDecorator
aggregateType
- The type of aggregate events are being appended foraggregate
- The aggregate for which the events are being storedeventStream
- The eventStream containing the events to append to the event storepublic void setSnapshotter(Snapshotter snapshotter)
snapshotter
- the snapshotter to notifypublic void setTrigger(int trigger)
trigger
- The default trigger value.public void setClearCountersAfterAppend(boolean clearCountersAfterAppend)
true
.
By setting this value to false, event counters are kept in memory. This is particularly useful when repositories
use caches, preventing events from being loaded. Consider registering the Caches use using setAggregateCache(org.axonframework.cache.Cache)
or setAggregateCaches(java.util.List)
clearCountersAfterAppend
- indicator whether to clear counters after appending eventspublic void setAggregateCache(Cache cache)
setAggregateCaches(java.util.List)
method if you have configured different caches for different
repositories.
Using this method will automatically set setClearCountersAfterAppend(boolean)
to false
.cache
- The cache used by caching repositoriessetAggregateCaches(java.util.List)
public void setAggregateCaches(List<Cache> caches)
caches
- The caches used by caching repositoriesCopyright © 2010-2014. All Rights Reserved.