Vurtatoo
Vurtatoo

Reputation: 366

Get SQSQueue name and messages Availible in queue

I received list of SQSQueue urls https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-list-all-queues.html

How can i receive queue name and messages available with current queue url?

Upvotes: 0

Views: 834

Answers (1)

Sergiiko
Sergiiko

Reputation: 319

You can use getQueueAttributes() method, e.g., using js sdk (https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SQS.html#getQueueAttributes-property):

new AWS.SQS({region:<REGION>})
  .getQueueAttributes({
    QueueUrl:<QUEUE_URL>,
    AttributeNames:['All']
  })
.promise()
.then(data=>{
  console.log(data)
})

Upvotes: 1

Related Questions