Skip to content

Commit a385a26

Browse files
Update main.py
1 parent eccaa35 commit a385a26

File tree

1 file changed

+2
-8
lines changed
  • integration-kinesis-to-lambda

1 file changed

+2
-8
lines changed

integration-kinesis-to-lambda/main.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
import base64
2-
import json
3-
import boto3
42
def lambda_handler(event, context):
5-
kinesis = boto3.client('kinesis')
3+
64
for record in event['Records']:
75
try:
86
print(f"Processed Kinesis Event - EventID: {record['eventID']}")
9-
record_data = get_record_data(record['kinesis'])
7+
record_data = base64.b64decode(record['kinesis']['data']).decode('utf-8')
108
print(f"Record Data: {record_data}")
119
# TODO: Do interesting work based on the new data
1210
except Exception as e:
1311
print(f"An error occurred {e}")
1412
raise e
1513
print(f"Successfully processed {len(event['Records'])} records.")
16-
def get_record_data(payload):
17-
data = base64.b64decode(payload['data']).decode('utf-8')
18-
# Placeholder for actual async work, you can use asyncio or threading for that
19-
return data

0 commit comments

Comments
 (0)