sqs-producer
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -1,1 +0,1 @@ | ||
module.exports = require('./lib/producer.js'); | ||
module.exports = require('./lib/producer.js'); |
var AWS = require('aws-sdk'); | ||
var selectn = require('selectn'); | ||
@@ -59,4 +60,15 @@ var BATCH_SIZE = 10; | ||
Producer.prototype.queueSize = function (cb) { | ||
this.sqs.getQueueAttributes({ | ||
QueueUrl: this.queueUrl, | ||
AttributeNames: ['ApproximateNumberOfMessages'] | ||
}, function (err, result) { | ||
if (err) return cb(err); | ||
cb(null, selectn('Attributes.ApproximateNumberOfMessages', result)); | ||
}); | ||
}; | ||
module.exports.create = function(options) { | ||
return new Producer(options); | ||
}; |
{ | ||
"name": "sqs-producer", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Enqueues messages onto a given SQS queue", | ||
@@ -29,2 +29,3 @@ "main": "index.js", | ||
"aws-sdk": "^2.1.2", | ||
"selectn": "^0.9.6", | ||
"sinon": "^1.12.2" | ||
@@ -31,0 +32,0 @@ }, |
@@ -23,2 +23,3 @@ sqs-producer | ||
// send messages to the queue | ||
producer.send(['msg1', 'msg2'], function(err) { | ||
@@ -28,2 +29,9 @@ if (err) console.log(err); | ||
// get the current size of the queue | ||
producer.queueSize(function (err, size) { | ||
if (err) console.log(err); | ||
console.log('There are', size, 'messages on the queue.'); | ||
}); | ||
``` | ||
@@ -30,0 +38,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35669
10
183
56
3
+ Addedselectn@^0.9.6
+ Addedselectn@0.9.6(transitive)