This is the NodeJS client for the Eventuate Platform.
System requirements:
npm i @eventuateinc/eventuate-nodejs-client
EVENTUATE_API_KEY_ID
EVENTUATE_API_KEY_SECRET
EVENTUATE_URL(default https://api.eventuate.io)
EVENTUATE_STOMP_SERVER_HOST(default api.eventuate.io)
EVENTUATE_STOMP_SERVER_PORT(default 61614)
EVENTUATE_SPACE_NAME
EVENTUATE_HTTP_KEEP_ALIVE(default true)
Setup environment variables:
EVENTUATE_API_KEY_ID
EVENTUATE_API_KEY_SECRET
var EventuateClient = require('@eventuateinc/eventuate-nodejs-client');
var EventuateClientConfiguration = EventuateClient.EventuateClientConfiguration;
const eventuateClientOpts = new EventuateClientConfiguration({ debug: true });
var eventuateClient = new EventuateClient(eventuateClientOpts);
var createEvents = [ { eventType: eventTypeCreated, eventData: { name: 'Fred' } } ];
eventuateClient.create('net.chrisrichardson.eventstore.example.MyEntityWasCreated', createEvents, function (err, createdEntityAndEventInfo) {
if (err) {
console.error(err);
throw err;
}
console.log(createdEntityAndEventInfo);
});
For an example of usage, please see test/AggregateRepository-spec.js
, test/AggregateRepositoryWithTriggeringEventToken-spec.js
and test/EventTypeSwimlaneDispatcher-spec.js
Requirements:
Install required Node.js modules:
npm install
The Eventuate Client and its modules are written in ES6.
Use next command to transform ES6 code to the ECMAScript 5:
npm run compile
It will create dist
directory.
Note: you need to compile ES6 sources before.
Requirements:
First install mocha:
npm install -g mocha
Run the tests:
npm test