0.1.3 • Published 2 years ago

aws-lambda-sqs-consumer v0.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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.

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago