Skip to content

Instantly share code, notes, and snippets.

@srcecde
Last active January 31, 2023 16:20
Show Gist options
  • Save srcecde/d8b1560fc0d7c91ebb4072397fab115b to your computer and use it in GitHub Desktop.
Save srcecde/d8b1560fc0d7c91ebb4072397fab115b to your computer and use it in GitHub Desktop.
import os
import json
import boto3
def lambda_handler(event, context):
if event:
messages_to_reprocess = []
batch_failure_response = {}
for record in event["Records"]:
try:
body = record["body"]
# process message
except Exception as e:
messages_to_reprocess.append({"itemIdentifier": record['messageId']})
batch_failure_response["batchItemFailures"] = messages_to_reprocess
return batch_failure_response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment