RDx
RDx

Reputation: 13

AWS SQS - Retrieve all message in queue using node JS

I have cronjob attached lambda running for every 5 minutes and processing SQS messages. In my queue have messages of more than 500. I need to retrieve all data and map each other based on ID. By default, I can able to retrieve only 10 messages. Is there any possibility to retrieve more than 10 messages?

Upvotes: 0

Views: 1405

Answers (1)

theherk
theherk

Reputation: 7546

Not in a single request, as you can see in the documentation, but you can just keep going. Just keep getting more, until there are none left.

To expand, the answer depends on which sdk you're using, but the api is the same. You just use something like a while loop where the condition checks the length of the list of messages returned. If that list is empty you leave the loop and finish. If it isn't empty you repeat the request.

Upvotes: 1

Related Questions