npm

Need private packages and team management tools?Check out npm Orgs. »

bragg-firehose

0.0.1-0 • Public • Published

bragg-firehose Build Status

bragg middleware for Firehose transformation Lambda trigger

About

This bragg middleware converts the AWS Kinesis Firehose data stream to a typical bragg request data structure. The implementation of a bragg Lambda for Firehose data transformation follows a strict structure and failure to implement the Lambda according to those rules will result in an error. See the documentation here and here

All transformed records from Lambda must contain the following parameters, or Kinesis Data Firehose rejects them and treats that as a data transformation failure.

recordId: The record ID is passed from Kinesis Data Firehose to Lambda during the invocation. The transformed record must contain the same record ID. Any mismatch between the ID of the original record and the ID of the transformed record is treated as a data transformation failure.

result: The status of the data transformation of the record. The possible values are: Ok (the record was transformed successfully), Dropped (the record was dropped intentionally by your processing logic), and ProcessingFailed (the record could not be transformed). If a record has a status of Ok or Dropped, Kinesis Data Firehose considers it successfully processed. Otherwise, Kinesis Data Firehose considers it unsuccessfully processed.

data: The transformed data payload, after base64-encoding.

Install

$ npm install bragg-firehose

Usage

const app = require('bragg');
const router = require('bragg-router');
const firehose = require('bragg-firehose');
 
const app = bragg();
// Install the Firehose bragg middleware
app.use(firehose());
app.use(routes());
 
const routes = () => {
    const router = router();
 
    router.post('forehose:myStreamName', ctx => {
        ctx.body = [
            {
                recordId: 'myReceivedRecordId',
                result: 'Ok',
                data: 'eyJmb28iOiJiYXIifQ=='
            }
        ];
    });
 
    return router.routes();
};
 
export const handler = app.listen();

API

firehose()

Install the bragg Firehose middleware

License

MIT © Simon Jang

install

npm i bragg-firehose

Downloadsweekly downloads

0

version

0.0.1-0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability