I recently started working with AWS, my first job is to consume a SQS queue using a lambda function.
I know I don't need to call receiveMessage because the lambda function already receives messages here:
exports.handler = async(event, context) => {
let i = 0;
for (const record of event.Records) {
...
}
};
My question is: should I call sqs.deleteMessage for every message received? I know the lambda function automatically deletes processed messages, but a friend told me I still have to call deleteMessage manually because IF an error occurs, all messages go back to the queue If I don't delete each message manually.
Thank you!