Newton's Programmatic Measurements

npm

npm’s 2019 JavaScript ecosystem survey analysis is now available!Get your copy here »

off-sqs

0.1.6 • Public • Published

OFF-SQS: Manage SQS on node.js

This easy manager provides the basic functionality to use Amazon SQS. To start using it just clone it or install it via npm npm install off-sqs and edit the aws-config.json:

{ 
	"accessKeyId": "STRING", 
	"secretAccessKey": "STRING", 
	"region": "STRING" 
}

NOTE that every operation checks first if the Queue exists, if not it'll create it.


Methods

Sender

Params: the name of the SQS queue and the data you want to send.
Returns: nothing.
Usage: sqs.sender('myQueue', ["foo": "bar"]);

Receiver

Params: the name of the SQS queue.
Return: a promise which it became a tuple of receivera function and queueUrl a string.
Usage:

sqs.receiver('myQueue').then(function(Receiver){
	Receiver.receiver(yourDataManager, Receiver.url);
}

Note: Where yourDataManager is a function that receives every message on the queue, so you can easy custom your data miner. Something like: `myMiner(messageOfTheQueue);``

getQueueUrl

Params: The name of the SQS Queue.
Returns: A promise which became the url of the Queue.
Usage:

sqs.getQueueUrl('myQueue').then(function('myQueueURL'){
	return myQueueURL;
});

parseMessage

Params: Data received by SQS Queues.
Returns: The cleaned data of the body as array.
Usage: sqs.parseMessage(data);

Keywords

none

install

npm i off-sqs

Downloadsweekly downloads

2

version

0.1.6

license

GNU

last publish

collaborators

  • avatar
Report a vulnerability