0.1.3 • Published 5 months ago

aws-lambda-sqs-consumer v0.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months 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

5 months ago

0.1.2

9 months ago

0.1.1

9 months ago

0.1.0

9 months ago