Socket
Socket
Sign inDemoInstall

sqs-consumer

Package Overview
Dependencies
40
Maintainers
2
Versions
90
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.1.1

.jsbeautifyrc

22

index.js
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var _ = require('lodash');
var AWS = require('aws-sdk');

@@ -11,6 +12,6 @@ var debug = require('debug')('sqs-consumer');

function validateOptions(options) {
function validate(options) {
requiredOptions.forEach(function (option) {
if (!options[option]) {
throw new Error('Missing SQS consumer option [' + option + '].');
throw new Error('Missing SQS consumer option [' + option + '].');
}

@@ -30,10 +31,11 @@ });

function Consumer(options) {
validateOptions(options);
AWS.config.update({region: options.region});
validate(options);
this.queueUrl = options.queueUrl;
this.handleMessage = options.handleMessage;
this.waitTime = options.waitTime || 100;
this.stopped = true;
this.sqs = options.sqs || new AWS.SQS();
this.sqs = options.sqs || new AWS.SQS({
region: options.region
});
this.poll = _.throttle(this._poll.bind(this), options.waitTime || 100);
}

@@ -50,3 +52,3 @@

this.stopped = false;
this._poll();
this.poll();
}

@@ -76,3 +78,3 @@ };

Consumer.prototype._handleSqsResponse = function(err, response) {
Consumer.prototype._handleSqsResponse = function (err, response) {
if (err) this.emit('error', err);

@@ -89,4 +91,4 @@

// Start polling for a new message after the wait time.
setTimeout(this._poll.bind(this), this.waitTime);
// Poll for another message
this.poll();
};

@@ -93,0 +95,0 @@

{
"name": "sqs-consumer",
"version": "1.1.0",
"version": "1.1.1",
"description": "Build SQS-based Node applications without the boilerplate",

@@ -30,4 +30,5 @@ "main": "index.js",

"aws-sdk": "^2.0.23",
"debug": "^2.1.0"
"debug": "^2.1.0",
"lodash": "^2.4.1"
}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc