Issue
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.
Solution
- You no need to use Spring framework in AWS Lambda use Java only
- Use Lambda with Cloud watch cron expression and schedule daily run.
- Write your own logic
- https://docs.aws.amazon.com/lambda/latest/dg/java-samples.html
- https://www.freecodecamp.org/news/using-lambda-functions-as-cronjobs/
Answered By - vaquar khan
Answer Checked By - Timothy Miller (JavaFixing Admin)