Skip to content

Commit bbe221a

Browse files
committed
update readme
1 parent 24ea207 commit bbe221a

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,37 @@ skip, limit always optional
473473
});
474474

475475

476+
## streaming your events
477+
Some databases support streaming your events, the api is similar to the query one
478+
479+
skip, limit always optional
480+
481+
var skip = 0,
482+
limit = 100; // if you omit limit or you define it as -1 it will retrieve until the end
483+
484+
var stream = es.streamEvents(skip, limit);
485+
// or
486+
var stream = es.streamEvents('streamId', skip, limit);
487+
// or by commitstamp
488+
var stream = es.streamEEventsSince(new Date(2015, 5, 23), skip, limit);
489+
490+
491+
stream.on('data', function(e) {
492+
doSomethingWithEvent(e);
493+
});
494+
495+
stream.on('end', function() {
496+
console.log('no more evets');
497+
});
498+
499+
// or even better
500+
stream.pipe(myWritableStream);
501+
502+
503+
currently supported by:
504+
505+
1. mongodb
506+
476507
## get the last event
477508
for example to obtain the last revision nr
478509

@@ -543,7 +574,6 @@ But if you want you can trigger this from outside:
543574
});
544575

545576

546-
547577
# Sample Integration
548578

549579
- [nodeCQRS](https://github.com/jamuhl/nodeCQRS) A CQRS sample integrating eventstore

0 commit comments

Comments
 (0)