Skip to content

Commit b008a39

Browse files
authored
Added ruby example
1 parent 218e553 commit b008a39

File tree

1 file changed

+19
-0
lines changed
  • integration-sqs-to-lambda-with-batch-item-handling

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
end
15+
16+
sqs_batch_response["batchItemFailures"] = batch_item_failures
17+
return sqs_batch_response
18+
end
19+
end

0 commit comments

Comments
 (0)