Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aws-sqs-connector

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-sqs-connector

Amazon WebService SQS Connector

  • 0.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

AWS SQS Connector

Tired of all the hassles connecting and polling a Amazon WebService SQS? The solution is here!

Install

npm install --save aws-sqs-connector

Initialize Queue

With CoffeeScript

SQSConnector = require 'aws-sqs-connector'

Queue = new SQSConnector
  credentials: './credentials/aws.json'
  queueUrl: 'http://sqs.<REGION>.amazonaws.com/<NUMBER>/queue-name'

With JavaScript

var SQSConnector = require('aws-sqs-connector');

var Queue = new SQSConnector({
  credentials: './credentials/aws.json',
  queueUrl: 'http://sqs.<REGION>.amazonaws.com/<NUMBER>/queue-name'
});

Poll Queue

With CoffeeScript

# Everytime there is a new message, this callback gets executed
Queue.receive (message, fetchNext) ->

  # log message
  console.log message

  # log attributes
  console.log message.attributes

  # do some processing with the message and then fetch the next message
  fetchNext()

With JavaScript

Queue.receive(function(message, fetchNext) {
  console.log(message);
  console.log(messages.attributes);
  fetchNext();
});

Send Message

send MessageBody, MessageAttributes, Callback

With CoffeeScript

Queue.send 'message body', { responseRequired: true, randomNumber: 1 }, (err, response) ->
  console.error(err) if err
  console.log response

With JavaScript

Queue.send('message body', { responseRequired: true, randomNumber: 1 }, function(err, response) {
  if (err) { console.error(err); }
  console.log(response);
});

Options

  • Credentials: The credentials json should be of the following format:
{
  "accessKeyId": "YOUR_ACCESS_KEY_ID",
  "secretAccessKey": "YOUR_SECRET_ACCESS_KEY",
  "region": "YOUR_REGION"
}

FAQs

Package last updated on 03 Jul 2015

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc