bragg-sqs

1.0.0 • Public • Published

bragg-sqs Build Status

SQS middleware for bragg

Handle SQS events as bragg requests.

About

SQS is an event source for AWS Lambda, see the link for more information about configuration. Keep in mind that in case of errors, the request is retried untill it succeeds or the message retention period is expired.

Source: Retries on error with event sources with AWS Lambda

If you configure an Amazon SQS queue as an event source, AWS Lambda will poll a batch of records in the queue and invoke your Lambda function. If it fails, AWS Lambda will continue to process other messages in the batch. Meanwhile, AWS Lambda will continue to retry processing the failed message.

Install

$ npm install bragg-sqs

Usage

const app = require('bragg')();
const router = require('bragg-router')();
const sqs = require('bragg-sqs');
 
// Listen for events in the `TopicName` topic
router.post('sqs:QueueName', ctx => {
    ctx.body = ctx.request.body;
});
 
app.use(sqs());
app.use(router.routes());
 
exports.handler = app.listen();

The sqs: prefix is added by the middleware to the queuename from where the events are generated. The message of the event is provided in the body property of the request object.

API

braggSqs()

Install the bragg SQS middleware.

License

MIT © Simon

Package Sidebar

Install

npm i bragg-sqs

Weekly Downloads

188

Version

1.0.0

License

MIT

Unpacked Size

4.02 kB

Total Files

4

Last publish

Collaborators

  • simonja