Permalink
Browse files

updated doc

  • Loading branch information...
1 parent 1443d5e commit adb83aecbd8812ddcde2b0d7d7fafa0aaaf57550 @jamuhl jamuhl committed Feb 14, 2012
View
@@ -62,19 +62,23 @@ <h2 id="subtitle" style="display: none;">Eventsourcing for node.js</h2>
<p>Example will use redis storage, but same will work for mongoDb and couchDb.</p>
-<pre><code><span class="kwd">var</span><span class="pln"> storage </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">require</span><span class="pun">(</span><span class="str">'eventstore.redis'</span><span class="pun">);</span><span class="pln"><br /><br />storage</span><span class="pun">.</span><span class="pln">createStorage</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">(</span><span class="pln">err</span><span class="pun">,</span><span class="pln"> store</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />&nbsp; &nbsp; es</span><span class="pun">.</span><span class="pln">configure</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />&nbsp; &nbsp; &nbsp; &nbsp; es</span><span class="pun">.</span><span class="kwd">use</span><span class="pun">(</span><span class="pln">store</span><span class="pun">);</span><span class="pln"><br />&nbsp; &nbsp; &nbsp; &nbsp; es</span><span class="pun">.</span><span class="kwd">use</span><span class="pun">(</span><span class="pln">publisher</span><span class="pun">);</span><span class="pln"> </span><span class="com">// your publisher must provide function 'publisher.publish(event)'</span><span class="pln"><br />&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="com">// es.use(logger);</span><span class="pln"><br />&nbsp; &nbsp; </span><span class="pun">});</span><span class="pln"><br /><br />&nbsp; &nbsp; </span><span class="com">// start eventstore</span><span class="pln"><br />&nbsp; &nbsp; es</span><span class="pun">.</span><span class="pln">start</span><span class="pun">();</span><span class="pln"><br /></span><span class="pun">});</span><span class="pln"><br /></span></code></pre>
+<pre><code><span class="kwd">var</span><span class="pln"> storage </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">require</span><span class="pun">(</span><span class="str">'eventstore.redis'</span><span class="pun">);</span><span class="pln"><br /><br />es</span><span class="pun">.</span><span class="pln">configure</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />&nbsp; &nbsp; es</span><span class="pun">.</span><span class="kwd">use</span><span class="pun">(</span><span class="pln">storage</span><span class="pun">.</span><span class="pln">createStorage</span><span class="pun">());</span><span class="pln"><br />&nbsp; &nbsp; es</span><span class="pun">.</span><span class="kwd">use</span><span class="pun">(</span><span class="pln">publisher</span><span class="pun">);</span><span class="pln"> </span><span class="com">// your publisher must provide function 'publisher.publish(event)'</span><span class="pln"><br />&nbsp; &nbsp; </span><span class="com">// es.use(logger);</span><span class="pln"><br /></span><span class="pun">}).</span><span class="pln">start</span><span class="pun">();</span><span class="pln"><br /></span></code></pre>
<h3>Work with the eventstore</h3>
<p>get the eventhistory of an aggregate</p>
-<pre><code><span class="pln">es</span><span class="pun">.</span><span class="pln">getEventStream</span><span class="pun">(</span><span class="pln">aggregateId</span><span class="pun">,</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(</span><span class="pln">err</span><span class="pun">,</span><span class="pln"> stream</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; </span><span class="kwd">var</span><span class="pln"> history </span><span class="pun">=</span><span class="pln"> stream</span><span class="pun">.</span><span class="pln">events</span><span class="pun">;</span><span class="pln"> </span><span class="com">// the original event will be in events[i].payload</span><span class="pln"><br /><br />&nbsp; &nbsp; </span><span class="com">// myAggregate.loadFromHistory(history);</span><span class="pln"><br /></span><span class="pun">});</span><span class="pln"><br /></span></code></pre>
+<pre><code><span class="pln">es</span><span class="pun">.</span><span class="pln">getEventStream</span><span class="pun">(</span><span class="pln">aggregateId</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(</span><span class="pln">err</span><span class="pun">,</span><span class="pln"> stream</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; </span><span class="kwd">var</span><span class="pln"> history </span><span class="pun">=</span><span class="pln"> stream</span><span class="pun">.</span><span class="pln">events</span><span class="pun">;</span><span class="pln"> </span><span class="com">// the original event will be in events[i].payload</span><span class="pln"><br /><br />&nbsp; &nbsp; </span><span class="com">// myAggregate.loadFromHistory(history);</span><span class="pln"><br /></span><span class="pun">});</span><span class="pln"><br /></span></code></pre>
<p>store a new event and commit it to store</p>
-<pre><code><span class="pln">es</span><span class="pun">.</span><span class="pln">getEventStream</span><span class="pun">(</span><span class="pln">aggregateId</span><span class="pun">,</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(</span><span class="pln">err</span><span class="pun">,</span><span class="pln"> stream</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /><br />&nbsp; &nbsp; stream</span><span class="pun">.</span><span class="pln">addEvent</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="kwd">event</span><span class="pun">);</span><span class="pln"><br />&nbsp; &nbsp; stream</span><span class="pun">.</span><span class="pln">commit</span><span class="pun">();</span><span class="pln"><br /><br /></span><span class="pun">});</span><span class="pln"><br /></span></code></pre>
+<pre><code><span class="pln">es</span><span class="pun">.</span><span class="pln">getEventStream</span><span class="pun">(</span><span class="pln">aggregateId</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(</span><span class="pln">err</span><span class="pun">,</span><span class="pln"> stream</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /><br />&nbsp; &nbsp; stream</span><span class="pun">.</span><span class="pln">addEvent</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="kwd">event</span><span class="pun">);</span><span class="pln"><br />&nbsp; &nbsp; stream</span><span class="pun">.</span><span class="pln">commit</span><span class="pun">();</span><span class="pln"><br /><br /></span><span class="pun">});</span><span class="pln"><br /></span></code></pre>
-<p>the committed event will be dispatched to the provided publisher</p>
+<p>the committed event will be dispatched to the provided publisher.</p>
+
+<p>you can even get an eventstream from a starting revision to an ending revision number:</p>
+
+<pre><code><span class="pln">es</span><span class="pun">.</span><span class="pln">getEventStream</span><span class="pun">(</span><span class="pln">aggregateId</span><span class="pun">,</span><span class="pln"> </span><span class="lit">5</span><span class="pln"> </span><span class="com">/*minRev*/</span><span class="pun">,</span><span class="pln"> </span><span class="lit">10</span><span class="pln"> </span><span class="com">/*maxRev*/</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(</span><span class="pln">err</span><span class="pun">,</span><span class="pln"> stream</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /></span><span class="pun">});</span><span class="pln"><br /></span></code></pre>
<h3>Work with snapshotting</h3>
@@ -104,6 +108,13 @@ <h2 id="subtitle" style="display: none;">Eventsourcing for node.js</h2>
<h2>Release Notes</h2>
+<h3>v0.5.0</h3>
+
+<ul>
+<li>simplified API for storage usage</li>
+<li>if possible fork dispatching to own childprocess</li>
+</ul>
+
<h3>v0.3.0</h3>
<ul>
@@ -150,4 +161,4 @@ <h2 id="subtitle" style="display: none;">Eventsourcing for node.js</h2>
</body>
-</html>
+</html>
View
@@ -1,6 +1,6 @@
{
"author": "jamuhl"
- , "name": "i18next_pages"
+ , "name": "EventStore_pages"
, "version": "0.0.1"
, "private": false
, "engines": {
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <html> <head> <title>consoleLogger.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="eventDispatcher.html"> eventDispatcher.js </a> <a class="source" href="eventStore.html"> eventStore.js </a> <a class="source" href="interfaces.html"> interfaces.js </a> <a class="source" href="consoleLogger.html"> consoleLogger.js </a> <a class="source" href="fakePublisher.html"> fakePublisher.js </a> <a class="source" href="storage.html"> storage.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> consoleLogger.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <pre><code>lib/logger/consoleLogger.js v0.3.0
+<!DOCTYPE html> <html> <head> <title>consoleLogger.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="eventDispatcher.html"> eventDispatcher.js </a> <a class="source" href="eventDispatcherProcess.html"> eventDispatcherProcess.js </a> <a class="source" href="eventStore.html"> eventStore.js </a> <a class="source" href="interfaces.html"> interfaces.js </a> <a class="source" href="json.html"> json.js </a> <a class="source" href="consoleLogger.html"> consoleLogger.js </a> <a class="source" href="fakePublisher.html"> fakePublisher.js </a> <a class="source" href="storage.html"> storage.js </a> <a class="source" href="util.html"> util.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> consoleLogger.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <pre><code>lib/logger/consoleLogger.js v0.5.0
(c) 2012 Kaba AG, MIC AWM; under MIT License
(by) Jan Muehlemann (jamuhl)
, Adriano Raiano (adrai)
Oops, something went wrong.

0 comments on commit adb83ae

Please sign in to comment.