ges-client

A nodejs client library for (Get) Event Store


Want to help out? Check out a waiting issue

Introduction
This client assumes that you already have an Event Store instance running.
Basic usage
Install
$ npm install ges-client
Append and read from an event stream
var ges = require('ges-client')
var connection = ges()
, stream = 'intro-events'
connection.on('connect', function() {
var appendData = {
expectedVersion: ges.expectedVersion.emptyStream
, events: [array of events]
}
connection.appendToStream(stream, appendData, function(err, appendResult) {
if(err) return console.log('Ooops!', err)
connection.readStreamEventsForward(stream, { start: 0, count: 1 }, function(err, readResult) {
if(err) return console.log('Ooops!', err)
console.log(readResult.Events)
})
})
})
Subscribe to stream updates
var ges = require('ges-client')
var connection = ges()
, stream = 'intro-events'
connection.on('connect', function() {
var subscription = connection.subscribeToStream(stream)
subscription.on('event', function(evt) {
console.log(evt)
})
var appendData = {
expectedVersion: ges.expectedVersion.emptyStream
, events: [array of events]
}
connection.appendToStream(stream, appendData, function(err, appendResult) {
if(err) return console.log('Ooops!', err)
})
})
Major Feature Status
- Connection (Partial - not all events are available)
- Append to stream (Complete)
- Read from stream (Complete)
- Subscriptions (Complete)
- Read from all (Complete)
- Stream ACLs (Not Started)
- Transactions (Complete)
- Stream deletes (Complete)
- Stream metadata (Complete)
License & copyright
Copyright (c) 2014 Brian Mavity.
ges-client is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
Special Thanks
Special thanks to Ken Pratt for writing the first version of this over at https://github.com/kenpratt/nodejs-EventStore .
It made early development go by much faster.
2015-09-18, Version 0.10.0, @bmavity
Notable changes
- Memory Leak Fix #39
- Babel error Fix (thanks @reharik) #47
- More stable test runner #46
- Potential Breaking Dropping a Catch Up Subscription is now async, it was causing subscription to not properly update it's last processed event
- Subscription Operations now verify a connection is writable before attempting to send a request to the server
- Change to use protobufjs library instead of abandoned protobuf library #51
- Potential Breaking Due to previous, commitPosition and preparePosition are now strings
Known issues
See https://github.com/bmavity/labels/bug for complete and current list of known issues.
- Attempting a subscription on a closed connection causes an unhandled exception.
- Running full test suite still giving false failures due to subscription drop timing issue.