Andrey Khomyakov
Andrey Khomyakov

Reputation: 9

Amazon SQS messages

For Amazon SQS - If the number of requests a cron job can make in a given window is exceeded by the number of messages received in SQS, how would you ensure all messages are processed in that window?

Upvotes: 0

Views: 253

Answers (1)

Sarat Chandra
Sarat Chandra

Reputation: 6120

Standard Queues can hold upto 120,000 Messages and Fifo queues can hold upto 20,000 Messages. These messages can be set to be retained upto 14days which is pretty much.

So Even If the number of requests a cron job can make in a given window is exceeded by the number of messages received in SQS:

  • All the Incoming messages are still stored in the queue.
  • The Cron Job/Jobs just takes the first message from the queue and processes it.
  • Make sure you know and set the Visibity time out while reading from the queue and delete the message from the queue after it is processes. Otherwise, the cron job keeps processing the same message again and again.
  • Refer other AWS SQS features for better processing And utilizing.

To ensure all messages are processed in that window, As I mentioned You just need run the CRON Job with proper setting.

If you have a Delivery deadline which we will be having in most of the cases, Configure the environment to be Autoscaled.

We can even configure scale-in and scale-out based on SQS message.

Happy to Help.. :)

Upvotes: 2

Related Questions