We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 218e553 commit b008a39Copy full SHA for b008a39
integration-sqs-to-lambda-with-batch-item-handling/example.rb
@@ -0,0 +1,19 @@
1
+require 'json'
2
+
3
+def lambda_handler(event:, context:)
4
+ if event
5
+ batch_item_failures = []
6
+ sqs_batch_response = {}
7
8
+ event["Records"].each do |record|
9
+ begin
10
+ # process message
11
+ rescue StandardError => e
12
+ batch_item_failures << {"itemIdentifier" => record['messageId']}
13
+ end
14
15
16
+ sqs_batch_response["batchItemFailures"] = batch_item_failures
17
+ return sqs_batch_response
18
19
+end
0 commit comments