69803

How to receive more than 10 amazon SQS message programmatically

Question:

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; } }

Answer1:

As per the documentation, <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html" rel="nofollow">10 is the maximum</a> per request.

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

Recommend

  • Cross-browser change an A tags' HREF
  • Unscrambling words in a sentence using Natural Language Generation
  • How do I add inbound security rules for EC2 using DNS?
  • Make Amazon S3 files available only to logged in users
  • Sails.js to client using sails.sockets.join and sails.sockets.broadcast doesn't return info to
  • Decoding PubNub messages with golang JSON
  • Grunt module(s) to upload all static assets to S3 / CloudFront, replace paths, and invalidate old as
  • Trouble Attaching Call Back to Unobtrusive Validation Show Error
  • Keep pika BlockingConnection alive without disabling heartbeat
  • When I try to upload and save an image file using Struts in eclipse it shows the file name as null
  • Spring Integration debounce/deduplicate
  • Special chars in Amazon S3 keys?
  • If I am creating a simple client server application in IntelliJ, how should this work?
  • ConnectivityManager.CONNECTIVITY_ACTION deprecated
  • android Navigation Bar hiding and persantage of usable screen overlap
  • Cuda Clang and OS X Mavericks
  • Exception gevent.hub.LoopExit: LoopExit('This operation would block forever',)
  • c# open webrowser in many tab
  • Instantiate interface in JAVA?
  • how to avoid repetitive constructor in children
  • Get history of file changes from TFS to implement custom “blame”-behaviour of exceptions
  • With Hadoop, can I create a tasktracker on a machine that isn't running a datanode?
  • Is there a way to do normal logging with EureakLog?
  • Custom Tabgroup Appcelerator
  • How to delay loading a property with linq to sql external mapping?
  • Disabling Alt-F4 on a Win Forms NotifyIcon
  • Can I display google adwords (AdView) in javafx on android
  • Uncaught Error: Could not find module `ember-load-initializers`
  • Opengl-es onTouchEvents problem or a draw problem? [closed]
  • Is there a amazon webstore API for customers?
  • output of program is not same as passed argument
  • Javascript + PHP Encryption with pidCrypt
  • Benchmarking RAM performance - UWP and C#
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Getting Messege Twice Using IMvxMessenger
  • How can I remove ASP.NET Designer.cs files?
  • How can i traverse a binary tree from right to left in java?
  • java string with new operator and a literal
  • How can I use threading to 'tick' a timer to be accessed by other threads?