Socket
Book a DemoInstallSign in
Socket

sque

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sque

A painless interface to Amazons SQS

0.0.2
latest
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Sque

Sque is painless interface to Amazons SQS, built for node.js.

Status

Current features:

  • 0.0.2 - SendMessage
  • 0.0.2 - SendMessageBatch
  • 0.0.1 - GetQueueAttributes
  • 0.0.1 - ReceiveMessage
  • 0.0.1 - DeleteMessage

Feature roadmap:

  • ListQueues / GetQueueUrl / CreateQueue / DeleteQueue / SetQueueAttributes
  • DeleteMessageBatch / ChangeMessageVisibility / ChangeMessageVisibilityBatch
  • AddPermission / RemovePermission

Installation

$ npm install sque

Usage

var Sque = require('sque');

// work with a specific queue:
var queue = Sque.getQueue({
  key      : '<AWS Key>',
  secret   : '<AWS Secret>',
  url      : '<AWS SQS queue url>'
});

/**
 * Queue attributes
 */

// get all queue attributes
queue.getAttributes(function( err, attributes ) {
  if ( err ) return console.log( err );
  console.log( attributes );
});

// get specific queue attribute
queue.getAttributes(['ApproximateNumberOfMessages'], function( err, attribute ) {
  if ( err ) return console.log( err );
  console.log( attribute );
});

// get multiple specific queue attributes
queue.getAttributes(['VisibilityTimeout', 'ApproximateNumberOfMessagesNotVisible'], function( err, attributes ) {
  if ( err ) return console.log( err );
  console.log( attributes );
});

/**
 * Queue subscription
 */

queue.subscribe({
  interval : 5000 // 5s polling interval; defaults to 10s if not sets
});

var messageCallback = function( message ) {
  console.log( 'queue message:' );
  console.dir( message );
  // ... do stuff with the message ...
  queue.deleteMessage( message.ReceiptHandle, function( err, success ) {
    if ( err ) return console.log( err );
    console.log( 'Hooray!' );
    console.dir( success );
  });
};
queue.on( 'message', messageCallback );

var messageErrorCallback = function( err ) {
  console.log( 'queue message error: ' );
  console.dir( err );
};
queue.on( 'message error', messageErrorCallback );

// unsubscribe
setTimeout(function() {
  queue.unsubscribe();
  queue.removeListener( 'message', messageCallback );
  queue.removeListener( 'message error', messageErrorCallback );
},20000);

License

(The MIT License)

Copyright (c) 2012 rocket eleven GmbH dominik@rocketeleven.de

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Keywords

amazon

FAQs

Package last updated on 04 Oct 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.