loopback-sqs-producer-mixin

1.0.5 • Public • Published

NPM

loopback-sqs-producer-mixin

SQS Producer mixin for loopback to add sendEvent method to your models.

INSTALL

  npm install loopback-sqs-producer-mixin --save

SERVER CONFIG

Add the mixins property to your server/model-config.json:

{
  "_meta": {
    "sources": [
      "loopback/common/models",
      "loopback/server/models",
      "../common/models",
      "./models"
    ],
    "mixins": [
      "loopback/common/mixins",
      "../node_modules/loopback-sqs-producer-mixin",
      "../common/mixins"
    ]
  }
}

MODEL CONFIG

To use with your Models add the mixins attribute to the definition object of your model config.

  {
    "name": "Widget",
    "properties": {
      "name": {
        "type": "string",
      }
    },
    "mixins": {
      "SQSProducer" : true
    }
  }

CONNEXIONS

To be able to connect to your SQS queue and listen for events in the topic, you have to set the SQS_QUEUE_URL and AWS_REGION env variables. You also have to set AWS_SECRET_ACCESS_KEY and AWS_ACCESS_KEY_ID for authentication.

export SQS_QUEUE_URL=https://sqs.eu-west-1.amazonaws.com/account-id/queue-name
export AWS_SECRET_ACCESS_KEY=...
export AWS_ACCESS_KEY_ID=...
export AWS_REGION=eu-west-1

LICENSE

Apache-2.0

/loopback-sqs-producer-mixin/

    Package Sidebar

    Install

    npm i loopback-sqs-producer-mixin

    Weekly Downloads

    39

    Version

    1.0.5

    License

    Apache-2.0

    Unpacked Size

    16.7 kB

    Total Files

    4

    Last publish

    Collaborators

    • skrafft