Event Source Mappings
are an AWS Lambda feature that can poll SQS queues, collect a number of messages, and invoke a Lambda Function when certain thresholds are met. The Event Source Mapping is an SQS consumer like any other, and like any other it will make the SQS messages invisible during processing. By default, if the Lambda Function fails to process any message in its batch, the entire batch - including successfully processed messages - is made visible again, and can thus be reprocessed. If a Redrive Policy has been configured, messages will be moved to the DLQ when the
threshold is crossed. This way successfully processed messages can end up on the DLQ too. This problem can partially (pun intended) be avoided by using the partial batch response
feature, which allows a Lambda Function to notify the Event Source Mapping which messages in a batch failed. When the Event Source Mapping receives a partial batch response it will delete the successful messages from the queue, and make the failed messages visible again. However, if a Lambda Function runs into an exception and is not able to return a partial batch response, the entire batch is reprocessed again.