キューからメッセージを取り出すサンプル
AWS = require "aws-sdk"
AWS.config.loadFromPath "aws.json"
sqs = new AWS.SQS().client
queueUrl = "ここにキューのURL"
options =
QueueUrl: queueUrl
MaxNumberOfMessages: 10
VisibilityTimeout: 60
WaitTimeSeconds: 20
sqs.receiveMessage options, (err, data) =>
console.log "### ERROR!", err if err
if data?.Messages?.length > 0
for message, i in data.Messages
console.log "### メッセージ:#{i}: ###"
console.log "Body:", message.Body
params =
QueueUrl: queueUrl
ReceiptHandle: message.ReceiptHandle
sqs.deleteMessage params, (err, data) =>
console.log "### メッセージを削除 ###"
console.log "ERROR!:", err if err
else
console.log "### メッセージがありません ###"