wmakeev
7/14/2016 - 2:35 PM

AWS SQS #aws #sqs

AWS SQS #aws #sqs

(function () {
  'use strict'

  AWS.config.update({
    accessKeyId: 'accessKeyId', 
    secretAccessKey: 'secretAccessKey'
  })

  AWS.config.region = 'eu-west-1'

  var sqs = new AWS.SQS()

  var params = {
    MessageBody: '{ "event": "from-chrome ' + Math.round(Math.random() * 1000) + '" }',
    QueueUrl: 'https://..', /* required */
    DelaySeconds: 0
  }

  sqs.sendMessage(params, function(err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else     console.log(data);           // successful response
  })

})()
https://s3-eu-west-1.amazonaws.com/vensi-common-public/libs/aws/aws-sdk-2.2.35.min.js?build=1
(function () {
  'use strict'

  AWS.config.update({
    accessKeyId: 'accessKeyId', 
    secretAccessKey: 'secretAccessKey'
  })

  AWS.config.region = 'eu-west-1'

  var sqs = new AWS.SQS()

  var params = {
    QueueUrl: 'https://..', /* required */
    MaxNumberOfMessages: 1,
    VisibilityTimeout: 20,
    WaitTimeSeconds: 0
  }

  sqs.receiveMessage(params, (err, data) => {
    if (err) console.log(err, err.stack); // an error occurred
    else     console.log(data);           // successful response
  });

})()