Skip to content

SimonJang/bragg-sqs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

SQS middleware for the bragg Lambda framework

Resources

License

Stars

Watchers

Forks

Packages

No packages published