Simple interface to amazon's simple queue service
npm install simple-queue-service
var sqs = ;var client = ;var queue = client;queue;queue;
All time spans can be passed either as a number of seconds, or any string accepted by ms (e.g.
'1 minute' => 60 seconds or
'2 minutes' => 120 seconds)
Creates a new client for the amazon simple queue service. SQS_REGION will default to 'us-east-1'. The regions translate as follows
'us-east-1' => Virginia 'us-west-1' => N. California 'us-west-2' => Oregon 'eu-west-1' => Ireland 'ap-southeast-1' => Singapore 'ap-northeast-1' => Tokyo
You can if you prefer set any of the three arguments by simply setting an environment variable of the same name (and arguments passed in will override any environment variables).
'1kb' => 1024 bytes
This method imediately returns a new Queue object. If something goes wrong with creating the queue, this resulting queue will 'throw' errors when you try and post/recieve messages to/from it.
The result is also a promise, which allows you to wait until it's fully initialized if you prefer.
The same as for
createQueue except that in the case you provide the full id, it won't be a promise.
A promise for an Array of Queue objects. They are never promises.
You can use
Client.Queue(name, 'SQS_ACCESS_KEY', 'SQS_SECRET_KEY', 'SQS_REGION') as an alternative to
Client('SQS_ACCESS_KEY', 'SQS_SECRET_KEY', 'SQS_REGION').getQueue(name).
This also provides access to the prototype of Queue.
The name of the queue (not the full identifier).
Puts a message into the queue
Gets the next message from the queue. If there are no available messages, this method will keep polling until there is a message.
A promise for a Message object.
Gets up to 'max' messages from the queue. It will return an empty array
 if there are no messages, rather than continuing to poll.
A promise for an array of Message objects.
Encapsulates a message retrieved from the queue, along with its metadata.
The parsed JSON body of the message.
The ID of the message sender.
A Date object for when the message was sent.
A Date object for when the message was first received (aproximate).
The aproximate number of times this message has been received (you probably want to give up if that number's unusually high).
You MUST call this once you're done, so the message does not get re-delivered. Returns a promise to indicate success.
Reset the visibilityTimeout to a new value. Returns a promise to indicate success.