Git Product home page Git Product logo

local-kinesis-lambda-runner's Introduction

local-kinesis-lambda-runner

The Rabble Rouser project makes extensive use of kinesis streams, and also uses lambda functions to process events from the stream. We want a way to spin up a whole Rabble Rouser instance locally, and this package is part of the solution to that problem.

This is a script that will poll a kinesis stream forever, and invoke your lambda function whenever a new event is detected.

Also if someone can come up with a better name, please do.

Usage

First install the package as a development dependency:

npm install --save-dev @rabblerouser/local-kinesis-lambda-runner

Then add a script to your project that looks something like this:

const run = require('@rabblerouser/local-kinesis-lambda-runner');
const lambda = require('./index').handler;

run(lambda);

You might also like to add an npm task to run that script:

{
  "scripts": {
    "start": "node localDev.js"
  }
}

Running it

If you follow the setup above, you can start up your lambda locally with npm start, although it won't work properly without a little configuration:

  • KINESIS_ENDPOINT: The endpoint where kinesis is located
  • STREAM_NAME: The name of the stream to poll

E.g:

KINESIS_ENDPOINT="http://kinesis:4567" STREAM_NAME="rabblerouser_stream" npm start

Note that this is only intended for local development with something like kinesalite, so the AWS region and credentials are internally hardcoded to arbitrary values. This script could be extended to support running against a real kinesis stream, it would just be a matter of parameterising the extra config.

For a full example of this script in action, see the docker-compose config for rabblerouser/core.

Publishing this library

Scoped packages (which this is) are private by default on npm, which is a paid feature. To publish publically, use this command:

npm publish --access=public

local-kinesis-lambda-runner's People

Contributors

camjackson avatar tareq89 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.