Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zdotfive/854541e4eaff5acfdd6ecc5a9cf97387 to your computer and use it in GitHub Desktop.
Save zdotfive/854541e4eaff5acfdd6ecc5a9cf97387 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