Socket
Socket
Sign inDemoInstall

sqs-producer

Package Overview
Dependencies
Maintainers
2
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqs-producer - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

26

lib/producer.js

@@ -0,10 +1,28 @@

'use strict';
var AWS = require('aws-sdk');
var selectn = require('selectn');
var requiredOptions = [
'queueUrl'
];
var BATCH_SIZE = 10;
function validate(options) {
requiredOptions.forEach(function (option) {
if (!options[option]) {
throw new Error('Missing SQS consumer option [' + option + '].');
}
});
if (options.batchSize > 10 || options.batchSize < 1) {
throw new Error('SQS batchSize option must be between 1 and 10.');
}
}
function Producer(options) {
validate(options);
this.queueUrl = options.queueUrl;
this.batchSize = options.batchSize || 10;
this.sqs = options.sqs || new AWS.SQS({
region: options.region
region: options.region || 'eu-west-1'
});

@@ -90,3 +108,3 @@ }

var producer = this;
var endIndex = startIndex + BATCH_SIZE;
var endIndex = startIndex + this.batchSize;
var batch = messages.slice(startIndex, endIndex);

@@ -136,3 +154,3 @@ var params = {

var size = selectn('Attributes.ApproximateNumberOfMessages', result);
cb(null, parseInt(size));
cb(null, parseInt(size, 10));
});

@@ -139,0 +157,0 @@ };

2

package.json
{
"name": "sqs-producer",
"version": "1.3.1",
"version": "1.3.2",
"description": "Enqueues messages onto a given SQS queue",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc