A Package to implement lambda listeners for some AWS Service events
npm install @janiscommerce/aws-listeners
const { SQSListener, ServerlessHandler } = require('@janiscommerce/aws-listeners');
class SomeSQSFunction extends SQSListener {
async process() {
// process the message
}
}
module.exports.handler = (...args) => ServerlessHandler.handle(SomeSQSFunction, ...args);
SQS
Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications.S3
Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.SNS
Amazon Simple Notification Service (SNS) is a highly available, durable, secure, fully managed pub/sub messaging service that enables you to decouple microservices, distributed systems, and serverless applications.
There is one common method that must be implemented in all the listeners:
This method is required, and should have the logic of your Listener.
For a more detailed explanation you can go to the following documents
'use strict';
const { S3Listener, S3ServerlessHandler } = require('@janiscommerce/aws-listeners');
class MyS3EventListener extends S3Listener {
async process() {
const data = await this.getData();
/* ... Your code to process the s3 event goes here ... */
}
}
module.exports.handler = (...args) => S3ServerlessHandler.handle(MyS3EventListener, ...args);