|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.eventsourcing.EventCountSnapshotterTrigger
public class EventCountSnapshotterTrigger
Snapshotter trigger mechanism that counts the number of events to decide when to create a snapshot. This implementation acts as a proxy towards the actual event store, and keeps track of the number of "unsnapshotted" events for each aggregate. This means repositories should be configured to use an instance of this class instead of the actual event store.
Constructor Summary | |
---|---|
EventCountSnapshotterTrigger()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EventCountSnapshotterTrigger()
Method Detail |
---|
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 store
public 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 store
public 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 repositories
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |