Managing Aws Sqs And Dlq
Scenario : create a lambda and it will be triggered whenever a message comes to SQS(let's assume SQS-A). The lambda (written in python)is responsible for sending the incoming paylo
Solution 1:
You are creating a complex architecture due to a simple problem (the target not being available). Try not to over-complicate things.
I would recommend:
- Have the originating system send the message to an Amazon SNS topic
- The topic triggers a Lambda function
- If it successfully processes the message, no further action required
- If the remote endpoint is not available, put the message into an Amazon SQS queue for later processing
- Use Amazon CloudWatch Events to trigger a Lambda function every n minutes that grabs any messages in the queue and tries to send them again. If the remote endpoint is still down, it exits and the process will be attempted again n minutes later.
- Probably worth also sending an email to an Admin if a message gets older than a few hours.
If you must send the original message to an SQS queue, then you could do as you described... send to Queue-A first, which triggers a Lambda function. If the endpoint is down, Lambda sends the message to Queue-B for later processing. However, only process from Queue-B every n minutes (rather than trying to make each individual message have its own delay timer).
Post a Comment for "Managing Aws Sqs And Dlq"