Skip to content

Commit 8e3b287

Browse files
authored
Add files via upload
1 parent 88c1f85 commit 8e3b287

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
require 'aws-sdk'
2+
3+
def lambda_handler(event:, context:)
4+
event['Records'].each do |record|
5+
begin
6+
puts "Processed Kinesis Event - EventID: #{record['eventID']}"
7+
record_data = get_record_data_async(record['kinesis'])
8+
puts "Record Data: #{record_data}"
9+
# TODO: Do interesting work based on the new data
10+
rescue => err
11+
$stderr.puts "An error occurred #{err}"
12+
raise err
13+
end
14+
end
15+
puts "Successfully processed #{event['Records'].length} records."
16+
end
17+
18+
def get_record_data_async(payload)
19+
data = Base64.decode64(payload['data']).force_encoding('UTF-8')
20+
# Placeholder for actual async work
21+
# You can use Ruby's asynchronous programming tools like async/await or fibers here.
22+
return data
23+
end

0 commit comments

Comments
 (0)