Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon SQS how to control the number of retries

I am configuring a beanstalk worker environment to deal with periodic tasks

When the requested URL is not responding with status 200 Elastic Beanstalk will put the task again in the queue.

How can I configure the number or retries?

I know the explanation is somewhere hidden behind ErrorVisibilityTimeout, InactivityTimeout, Dead Letter Queues... but these concepts are still not growing green in my inefficient mind.

For example I just want to configure maximum number of retries 0 so there is try but not any retry.

like image 379
fguillen Avatar asked Feb 09 '17 17:02

fguillen


People also ask

How many times will SQS Retry?

You can have maximum of 2 retries with lambda for asynchronous invocations and up to 1000 SQS retries.

What is SQS receive message wait time?

In most cases, you can set the ReceiveMessage wait time to 20 seconds. If 20 seconds is too long for your application, set a shorter ReceiveMessage wait time (1 second minimum).

What is the default setting for SQS visibility timeout?

Every Amazon SQS queue has the default visibility timeout setting of 30 seconds. You can change this setting for the entire queue. Typically, you should set the visibility timeout to the maximum time that it takes your application to process and delete a message from the queue.

How long can you keep your Amazon SQS messages in Amazon SQS queue?

You can configure the Amazon SQS message retention period to a value from 1 minute to 14 days. The default is 4 days. Once the message retention quota is reached, your messages are automatically deleted.


1 Answers

Enable Dead Letter Queues, and set the DLQ Maximum Receives value to 1. This means that a message can only be received (and not deleted) one time before it is sent to the Dead Letter Queue.

Update, adding screenshots

This field is found into the beanstalk environment admin into Configuration > Worker Configuration > Advanced Options:

enter image description here

Or into the the SQS Queue admin into Queue Actions > Configure Queue:

enter image description here

Changing the value in one place will propagate the change to the other place.

like image 191
Mark B Avatar answered Sep 24 '22 19:09

Mark B