Skip to content

Commit 4f92047

Browse files
authored
Merge pull request #91 from ssnskar/main
Ruby Code Snippet for Lambda SQS Integration
2 parents a35d8ca + ea9e1a6 commit 4f92047

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

integration-sqs-to-lambda/Function.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
def lambda_handler(event:, context:)
2+
event['Records'].each do |message|
3+
process_message(message)
4+
end
5+
puts "done"
6+
end
7+
8+
def process_message(message)
9+
begin
10+
puts "Processed message #{message['body']}"
11+
# TODO: Do interesting work based on the new message
12+
rescue StandardError => err
13+
puts "An error occurred"
14+
raise err
15+
end
16+
end

integration-sqs-to-lambda/snippet-data.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Sample Amazon SQS function code",
44
"type": "Integration",
55
"services": ["lambda", "sqs"],
6-
"languages": ["Node", ".NET", "TypeScript", "Java","Python","Go"],
6+
"languages": ["Node", ".NET", "TypeScript", "Java", "Ruby", "Python", "Go"],
77
"tags": [],
88
"introBox": {
99
"headline": "How it works",
@@ -64,6 +64,17 @@
6464
}
6565
]
6666
},
67+
{
68+
"id": "Ruby",
69+
"title": "Usage Example with Ruby:",
70+
"description": "Sample Amazon SQS function code using Ruby without batch item handling.",
71+
"snippets": [
72+
{
73+
"snippetPath": "Function.rb",
74+
"language": "rb"
75+
}
76+
]
77+
},
6778
{
6879
"id": "Python",
6980
"title": "Usage Example with Python:",
@@ -114,7 +125,7 @@
114125
"linkedin": "girishbalachandran"
115126
},
116127
{
117-
"headline": "Python Example Presented by Girish B",
128+
"headline": "Python & Ruby Example Presented by Sanskar",
118129
"name": "Sanskar",
119130
"bio": "Cloud Support Engineer at AWS",
120131
"linkedin": "Sanskar05"

0 commit comments

Comments
 (0)