Skip to content

Latest commit

 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lambda-sqs-consumer

Overview

An event source mapping compliant lambda consumer factory for Amazon Simple Queue Service (SQS). The consumer function processes messages by type which is present as a JSON string inside the message body.

Example

Here's an example:

const { createSQSConsumer } = require("aws-lambda-sqs-consumer");

exports.handler = createSQSConsumer({
  events: {
    EVENT_TYPE_A: {
      handler(message) {
        console.log("Processing type a:", message.messageId);
      },
    },
    EVENT_TYPE_B: {
      handler(message) {
        console.log("Processing type b:", message.messageId);
      },
    },
  },
});

This would process messages of the type EVENT_TYPE_A and EVENT_TYPE_B.

Here's a sample message body for EVENT_TYPE_A:

{ "type": "EVENT_TYPE_A", "payload": { "someproperty": "somevalue" } }

Reference

The reference can be found here.

About

A library that constructs an event-type based consumer for an SQS queue.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages