loopback-sqs-producer-mixin
v1.0.5
Published
Amazon Simple Queue Service Producer mixin for loopback to add sendEvent method to your models
Downloads
115
Maintainers
Readme
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] (LICENSE)