I am trying to retrieve all the messages in the queue using the AWS PHP SDK.
Earlier there used to be a get_queue_size() method to get the queue size and then I would iterate through the loop to get all the messages.
In the newest SDK I don't see such a method. Link
Can someone tell me how I can receive all the messages in the queue using the latest SDK for PHP ?
You can get all the messages in the queue, you just can't get them all at once. You request messages, and specify the max you want up to a max of 10 at a time, anymore than that, and you'll need to request another set of messages until your queue is empty (and even then you need to constantly poll SQS if there is a possibility that new messages will be coming in at anytime).
Also important to remember that even if you have less than 10 messages in the queue, and you request the max of 10 (and even if there are no other clients currently polling), you still may not get all of the messages in the queue on a given call - you need to poll repeatedly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With