AWS SQS delay on retry

0

Hello,

There is a question: can we set up AWS SQS delay for the next retry attempt?

The main goal:

  • I put in SQS the messages which are planned so be sent as email
  • Imagine the 1st attempt of sending mail failed (e.g: server down)
  • The retry will happen
  • So I want to postpone the next retry attempt to provide some time for a server to restore.

Appreciate any help. Thanks!

質問済み 8ヶ月前2591ビュー
2回答
0
承認された回答

You can't control the retry schedule from SQS, but you have a couple of options:

  1. Remove the message from the queue and put it back in, with a delay (note that you can set the delay for each message individually, no need to define a delay queue).
  2. Set the visibility timeout to some larger value and do not delete the message.
profile pictureAWS
エキスパート
Uri
回答済み 8ヶ月前
0

Hello.

Configure the Delay Attribute: By default, SQS queues have a delay of 0 seconds, meaning messages are available for processing as soon as they are sent to the queue. To introduce a delay, you'll need to set the DelaySeconds attribute when sending messages to the queue.

Using the AWS Management Console: When you send a message through the console, you can specify the delay in seconds as shown in the console UI.

Using the AWS CLI: You can use the --delay-seconds parameter when using the aws sqs send-message command. For example: aws sqs send-message --queue-url <queue-url> --message-body "Your message" --delay-seconds 300

Using an SDK: When using an SDK, you can set the DelaySeconds attribute in the message attributes or properties before sending the message.

But be careful that messages that have a delay set will not be visible to consumers until the specified delay period has passed. After the delay period, the messages become available for retrieval by consumers.

Best regards, Andrii

profile picture
エキスパート
回答済み 8ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ