nestorjs
v0.1.1
Published
NodE STream prOcessoR
Downloads
7
Maintainers
Readme
Stream Processing framework for NodeJS
...for running a set of transformations on unbounded streams of data
##Features
- Time ordering
- Count and Time windowing Semantics
- Express rules in plain javascript
- Event Time and Processing Time Semantics
- Intuitive Dashboard for Visual Monitoring
- Distributed Processing via load balanced V8 Instances
- Enable V8 Clustering
- Stateful and Stateless stream computations
- Supports sources include Kafka and NATS Consumers
- Internally uses STATSD to emit data about sources, operators and sinks
- Fluent API for composing operations
Introduction
npm install nestorjs --save
Getting started
const Nestor = require('nestorjs');
const processor = new Nestor.Engine({
logging: {
level: 'debug'
},
cluster: true
})
Add a Source
processor.setSource(function(config) {
const httpSource = http.createServer((response) => {
});
config.registerSource(httpSource)
})
Stateless Event Computation
const processTempJob = function (event, done){
if(event.data.temparature > 50) {
/**
*
* event is the source data
* store is an area to persist data between events
* done() can also receive destination options
*
**/
return done(false) //accumulate
}
return done(true) // send to next job in pipeline or out to sink
}
Stateful Event Computation
const processTempJob = function (event, store, done){
if(event.data.temparature > 50) {
/**
*
* event is the source data
* store is an area to persist data between events
* done() can also receive destination options
*
**/
store.set(event.name, event.data);
return done(false) //accumulate
}
return done(true) // send to next job in pipeline or out to sink
}