Socket
Socket
Sign inDemoInstall

sqs-consumer

Package Overview
Dependencies
69
Maintainers
4
Versions
90
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 3.1.0

3

index.js

@@ -40,2 +40,3 @@ 'use strict';

* @param {function} options.handleMessage
* @param {array} options.attributeNames
* @param {array} options.messageAttributeNames

@@ -52,2 +53,3 @@ * @param {number} options.batchSize

this.handleMessage = options.handleMessage;
this.attributeNames = options.attributeNames || [];
this.messageAttributeNames = options.messageAttributeNames || [];

@@ -98,2 +100,3 @@ this.stopped = true;

QueueUrl: this.queueUrl,
AttributeNames: this.attributeNames,
MessageAttributeNames: this.messageAttributeNames,

@@ -100,0 +103,0 @@ MaxNumberOfMessages: this.batchSize,

2

package.json
{
"name": "sqs-consumer",
"version": "3.0.0",
"version": "3.1.0",
"description": "Build SQS-based Node applications without the boilerplate",

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

@@ -80,2 +80,3 @@ # sqs-consumer

* `handleMessage` - _Function_ - A function to be called whenever a message is received. Receives an SQS message object as its first argument and a function to call when the message has been handled as its second argument (i.e. `handleMessage(message, done)`).
* `attributeNames` - _Array_ - List of queue attributes to retrieve (i.e. `['All', 'ApproximateFirstReceiveTimestamp', 'ApproximateReceiveCount']`).
* `messageAttributeNames` - _Array_ - List of message attributes to retrieve (i.e. `['name', 'address']`).

@@ -82,0 +83,0 @@ * `batchSize` - _Number_ - The number of messages to request from SQS when polling (default `1`). This cannot be higher than the AWS limit of 10.

@@ -243,2 +243,3 @@ 'use strict';

QueueUrl: 'some-queue-url',
AttributeNames: [],
MessageAttributeNames: ['attribute-1', 'attribute-2'],

@@ -253,2 +254,41 @@ MaxNumberOfMessages: 3,

});
it('consumes messages with message attibute \'ApproximateReceiveCount\'', function (done) {
var messageWithAttr = {
ReceiptHandle: 'receipt-handle-1',
MessageId: '1',
Body: 'body-1',
Attributes: {
ApproximateReceiveCount: 1
}
};
sqs.receiveMessage.yieldsAsync(null, {
Messages: [messageWithAttr]
});
consumer = new Consumer({
queueUrl: 'some-queue-url',
attributeNames: ['ApproximateReceiveCount'],
region: 'some-region',
handleMessage: handleMessage,
sqs: sqs
});
consumer.on('message_received', function (message) {
sinon.assert.calledWith(sqs.receiveMessage, {
QueueUrl: 'some-queue-url',
AttributeNames: ['ApproximateReceiveCount'],
MessageAttributeNames: [],
MaxNumberOfMessages: 1,
WaitTimeSeconds: 20,
VisibilityTimeout: undefined
});
assert.equal(message, messageWithAttr);
done();
});
consumer.start();
});
});

@@ -255,0 +295,0 @@

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