Chester Devs Presentation and source code – ‘Event Store - an introduction to a DSD for event sourcing and notifications’

Posted by Liam Westley on Geeks with Blogs See other posts from Geeks with Blogs or by Liam Westley
Published on Mon, 11 Nov 2013 16:15:20 GMT Indexed on 2013/11/12 3:57 UTC
Read the original article Hit count: 868

Filed under:
|
|
|

Originally posted on: http://geekswithblogs.net/twickers/archive/2013/11/11/chester-devs-presentation-and-source-code-ndash-lsquoevent-store.aspx

Thank you everyone at Chester Devs

Thanks to Fran Hoey and all the people from Chester Devs. It was a hard drive up and back but the enthusiasm of the audience, with some great questions does make it worthwhile.

Presentation and source code

My presentation, source code, Event Store runners and text files containing the various command line parameters used for curl is now available on GitHub; https://github.com/westleyl/ChesterDevs-EventStore.

Don’t worry if you don’t have a GitHub account, you don’t need one, you can just click on the Download Zip button on the right hand menu to download all the files as a single ZIP file.  If all you want is the PowerPoint presentation, go to https://github.com/westleyl/ChesterDevs-EventStore/blob/master/Powerpoint/Huddle-EventStore.pptx, and click on the View Raw button.

Downloading and installing Event Store and Tools

Download Event Store http://download.geteventstore.com – I unzipped these files into C:\EventStore\v2.0.1

Download Curl from http://curl.haxx.se/download.html – I downloaded Win64 Generic (with SSL) and unzipped these files into C:\curl version 7.31.0

Running the tools I used in my presentation

Demonstration 1 (running Event Store)

You can use one of my Event Store runner command files to run the single node version of Event Store, using default ports of 2213 for HTTP and 1113  for TCP, and with a wildcard HTTP pattern.  Both take a single command line parameter to specify the location of the data and log files.  The runners assume the single node executable is located in C:\EventStore\v2.0.1, and will placed data files and logs beneath C:\EventStore\Data, i.e.

RunEventStore.cmd TestData1

This will create data files in C:\EventStore\Data\TestData1\Data and log files in C:\EventStore\Data\TestData1\logs.

If, when running Event Store you may see the following message,

[03288,15,06:23:00.622] Failed to start http server
Access is denied

You will either need to run Event Store in an administrator console window, or you can use the netsh command to create a firewall permission to allow HTTP listening (this will need to be run, once, in an administrator console window),

netsh http add urlacl url=http://*:2213/ user=liam

You can always delete this later by running the delete; netsh http delete urlacl url=http://*:2213/

If you want to confirm that everything is running OK, open the management console in a browser by navigating to http://127.0.0.1:2213. If at any point you are asked for a user name and password use the default of ‘admin’/‘changeit’.

Demonstration 2 (reading and adding data, curl)

In my second demonstration I used curl directly from the console to read streams, write events and then read back those events. On GitHub I have included is a set of curl commands, CurlCommandLine.txt, and a sample data file, SampleData.json, to load an event into a DDDNorth3 stream.

As there is not much data in the Event Store at this point I used the $stats-127.0.0.1:2113 which is a stream containing performance statistics for Event Store and is updated every 30 seconds (default).

Demonstration 3 (projections)

On GitHub I have included a sample projection, Projection-ByRoom.txt, which will create streams based on the room on which a session was held on the DDDNorth3 agenda.

Browse to the management console, http://127.0.0.1:2213.  Click on Projections, New Projection, give it a name, Sessions-ByRoom, and copy in the JavaScript in the Projection-ByRoom.txt file.  Select Continuous, tick Emit Enabled and then click on Post. It should run immediately.

You may by challenged for the administration login for the management console, if so use the default user name and password; 'admin'/'changeit'.

Demonstration 4 (C# client)

The final demonstration was the Visual Studio 2012 project using the Event Store client – referenced directly as C:\EventStore\v2.0.1\EventStore.ClientAPI.dll, although you can switch this to the latest Event Store client NuGet package.

The source code provides a console app for viewing projections with the projection manager (HTTP connection), as well as containing a full set of data for the entire DDDNorth3 agenda.  It also deals with the strategy for reading newest events backwards to older events and ignoring older events that have been superseded.

Resources

Event Store home page: http://www.geteventstore.com/

Event Store source code on GitHub: https://github.com/eventstore/eventstore

Event Store documentation on GitHub: https://github.com/eventstore/eventstore/wiki (includes index to @RobAshton’s blog series on Event Store at https://github.com/eventstore/eventstore/wiki#rob-ashton---projections-series)

Event Store forum in Google Groups: https://groups.google.com/forum/?fromgroups#!forum/event-store

TopShelf Windows service wrapper is available on github: https://gist.github.com/trbngr/5083266

© Geeks with Blogs or respective owner

Related posts about ddd

Related posts about Development