Last active
January 31, 2023 16:20
-
-
Save srcecde/d8b1560fc0d7c91ebb4072397fab115b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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