Reputation: 1440
Our requests are currently rate limited by an external API so we want to develop a retry mechanism.
For this, we have decided to use SQS (to queue all requests), connected to a Lambda function (to call the external API). As per defaults 3 Lambda function retries look good but is there any way we can schedule those retries after X second (Since the external API returns back after how many seconds we can retry)?
And for requests which are failed even after 3 retries, we have decided to use DLQ (Dead Letter Queues) and to process those requests in off-peak hours. So what is the best way to do this? We are currently thinking to launch another consumer connected only to DLQ, triggered though Scheduled Events Cron.
Also what happens if the requests in DLQ are failed? We still want to process those.
Thanks
Upvotes: 1
Views: 894
Reputation: 1440
I have actually got a workaround. In case of failure, I can delete message from SQS then re add the same message with initial invisibility period equal to the retry time (got from external API). In this way I can build my own retry mechanism (both SQS and DLQ) according to my needs.
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-timers.html
Upvotes: 0