Permalink
Browse files

added doc for replaying events

  • Loading branch information...
1 parent 2040b4f commit b43b97de3d9f0505bcb3f6ddd86c71634ded8deb Adriano Raiano committed Oct 1, 2012
Showing with 28 additions and 0 deletions.
  1. +28 −0 README.markdown
View
@@ -105,7 +105,35 @@ create a snapshot point
});
+### Replaying events
+If you want to replay all events from the store you can do it with the function getEventRange:
+
+ var match = {} // match query in inner event (payload), for example: { id: eventId }
+ // if {} all events will return
+ , amount = 20; // amount of events to receive per request
+
+ var handle = function(err, events) {
+ // events is the eventstream
+ if (events.length === amount) {
+ events.next(handle);
+ } else {
+ // finished to replay
+ }
+ };
+
+ es.getEventRange(match, amount, handle);
+
+
+If you want to replay all events of a particular aggregate or stream you can do it with the function getEvents:
+
+ var streamId = '1234'
+ , revMin = null // optional, must be a number
+ , revMax = null; // optional, must be a number
+
+ es.getEvents(streamId, revMin, revMax, function(err, events) {
+ // events is the eventstream
+ });
# Sample Integration

0 comments on commit b43b97d

Please sign in to comment.