|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.axonframework.eventstore.fs.FileSystemEventStore
public class FileSystemEventStore
Implementation of the EventStore that serializes objects using XStream and
writes them to files to disk. Each aggregate is represented by a single file, where each event of that aggregate is a
line in that file. Events are serialized to XML format, making them readable for both user and machine.
setBaseDir(org.springframework.core.io.Resource) to specify the directory where event files should be
stored.
Note that the resource supplied must point to a folder and should contain a trailing slash. See FileSystemResource.FileSystemResource(String).
| Constructor Summary | |
|---|---|
FileSystemEventStore()
Basic initialization of the event store. |
|
FileSystemEventStore(EventSerializer eventSerializer)
Customized initialization of the event store. |
|
| Method Summary | |
|---|---|
void |
appendEvents(String type,
DomainEventStream eventsToStore)
Append the events in the given stream to the event store. |
void |
appendSnapshotEvent(String type,
DomainEvent snapshotEvent)
Append the given snapshotEvent to the snapshot event log for the given type type. |
DomainEventStream |
readEvents(String type,
AggregateIdentifier identifier)
Read the events of the aggregate identified by the given type and identifier that allow the current aggregate state to be rebuilt. |
void |
setBaseDir(org.springframework.core.io.Resource baseDir)
Sets the base directory where the event store will store all events. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileSystemEventStore()
XStreamEventSerializer
public FileSystemEventStore(EventSerializer eventSerializer)
eventSerializer .
eventSerializer - The serializer to serialize DomainEvents with| Method Detail |
|---|
public void appendEvents(String type,
DomainEventStream eventsToStore)
stream to the event store.
This implementation writes events to an event log on the file system. It uses a directory per type of aggregate,
containing 1 file per aggregate.
appendEvents in interface EventStoretype - The type descriptor of the object to storeeventsToStore - The event stream containing the events to store
public DomainEventStream readEvents(String type,
AggregateIdentifier identifier)
readEvents in interface EventStoretype - The type descriptor of the object to retrieveidentifier - The unique aggregate identifier of the events to load
public void appendSnapshotEvent(String type,
DomainEvent snapshotEvent)
snapshotEvent to the snapshot event log for the given type type. The
sequence number of the snapshotEvent must be equal to the sequence number of the last regular domain
event that is included in the snapshot.
Note that the aggregate identifier and sequence number must be set on the DomainEvent. See DomainEvent.DomainEvent(long, org.axonframework.domain.AggregateIdentifier).
appendSnapshotEvent in interface SnapshotEventStoretype - The type of aggregate the event belongs tosnapshotEvent - The event summarizing one or more domain events for a specific aggregate.
EventStoreException - when an error occurs while reading or writing to the event logs.org.axonframework.domain.DomainEvent#DomainEvent(long, org.axonframework.domain.AggregateIdentifier))public void setBaseDir(org.springframework.core.io.Resource baseDir)
baseDir - the location to store event files
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||