Git Product home page Git Product logo

sails-persistence-stream's Introduction

Sails Persistence Stream

NPM

Automatically stream all Sails model persistence events to a distributed log

Install

npm install --save sails-persistence-stream

Use

To use Sails Persistence Stream out of the box add the streamer to config/models.js default persistence hooks so it looks like the following example:

var sailsPersistenceStream = require('sails-persistence-stream')();

module.exports.models = {
  afterCreate: function(record, cb) {
    sailsPersistenceStream.afterCreate(record, this).then(data => {
      cb();
    });
  },
  afterUpdate: function(record, cb) {
    sailsPersistenceStream.afterUpdate(record, this).then(data => {
      cb();
    });
  },
  afterDestroy: function(record, cb) {
    sailsPersistenceStream.afterDestroy(record, this).then(data => {
      cb();
    });
  }
};

API

require('sails-persistence-stream')(options: Object)

Initializes Sails Persistence Stream with the given options. All options are optional.

  • options.stream: Kinesis stream name (must exist already)
  • options.region: (default: us-east-1) AWS region
  • options.logger: Log4js compatible logger which Sails Persistence Stream will use (set to null for no logging)
  • options.endpoint: (Optional) Alternative Kinesis endpoint (for local testing use Kinesalite)

sails-persistence-stream's People

Contributors

theconnman avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.