Question

In my code I read the SQS message results using recieveMessageResponse.RecieveMessageResult.Message[i] inside a loop. I wanted to know if there is an option to limit the amount of queue messages available to read from the client?

I am concerned about a situation when there are thousands of queue messages and each time my image processing server finishes processing an image, it needs to get the queue results again. This means that the queue data of thousands of need-to-be-processed images will need to be retrieved by my EC2 server.

I am using the C# SDK for .NET.

Was it helpful?

Solution

You can set the limit you want to recieve at anyone time, to a maximum of 10 - which is the default(and max). You'll never get more than 10 at once, so you don't need to worry about getting too many.

Now that a message is in the queue, you can receive it (retrieve it from the queue). When requesting to get a message from the queue, you can't specify which message to get. You simply specify the maximum number of messages you want to get (up to 10), and Amazon SQS returns up to that maximum number.

http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSGettingStartedGuide/ReceiveMessage.html

http://docs.aws.amazon.com/sdkfornet1/latest/apidocs/html/T_Amazon_SQS_Model_ReceiveMessageRequest.htm

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top