Home > Net >  AWS Lambda function used with a DLQ
AWS Lambda function used with a DLQ

Time:08-29

I have an SQS queue with a supported DLQ for failures. I want to write a custom Lambda function in java (spring boot) to get the messages from this dlq, write it to a file, upload the file to an S3 bucket and send the file as an alert to a specified webhook.

I'm new to lambda and I hope this design can be implemented.

One requirement is that I want to execute the Lambda only once per day. So let's say at 6:00 am everyday. I want all the messages in the queue to be written to a file.

I'm trying to see examples of RequestHandler being implemented where the messages in the queue are received and iterated to be saved in the file one at a time.

I'm not sure how to configure the lambda such that it runs only once per day instead of each time a message entering the DLQ.

Any documentation relating to these queries will be really helpful. Please critique my expected implementation and offer any better solutions for the same.

CodePudding user response:

You can have your lambda code run on any schedule (once per day for your case) using CloudWatch Event Schedule.

To create the schedule, follow this link

In you lambda code, you can fetch the messages from DLQ and process them iteratively.

CodePudding user response:

  1. You no need to use Spring framework in AWS Lambda use Java only
  2. Use Lambda with Cloud watch cron expression and schedule daily run.
  3. Write your own logic
  • Related