How to receive more than 10 amazon SQS message programmatically

Viewed 5895

We have SQS Standard Message Queue and its growing very fast. most of time we receiving old notification. We have configure Message Retention Period for 2 days. Is there any way to receive more than 10 messages programmatically. Following is my code to revive SQS Messages from amazon.

private IEnumerable<Message> getMessagesFromQ(string accessKeyId, string secretAccessKey, string myQueueURL)
    {
        using (var amazonSQSClient = new AmazonSQSClient(accessKeyId, secretAccessKey, Amazon.RegionEndpoint.USWest2))
        {

            ReceiveMessageRequest recieveMessageRequest =
                new ReceiveMessageRequest();

            recieveMessageRequest.QueueUrl = myQueueURL;
            recieveMessageRequest.MaxNumberOfMessages = 10;

            ReceiveMessageResponse receiveMessageResponse =
                amazonSQSClient.ReceiveMessage(recieveMessageRequest);

            return receiveMessageResponse.Messages;
        }
    }
1 Answers

As per the documentation, 10 is the maximum per request.

To increase message processing throughput in SQS, extra queue readers are typically added.

Related