-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathb.txt
More file actions
35 lines (27 loc) · 857 Bytes
/
b.txt
File metadata and controls
35 lines (27 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
SQS Lamda code
-------------------
console.log('Lambda function initialized');
export const handler = async (event, context) => {
console.log("Received SQS event:", JSON.stringify(event, null, 2));
for (const record of event.Records) {
const messageBody = record.body;
console.log("📩 Raw message body:", messageBody);
try {
const data = JSON.parse(messageBody);
console.log("✅ Parsed Message:");
console.log("key1:", data.key1);
console.log("key2:", data.key2);
console.log("key3:", data.key3);
} catch (err) {
console.error("❌ Error parsing message body:", err);
}
}
return "✅ SQS message(s) processed successfully";
};
-----------------------------------------------------------------------------
send receive message
{
"key1": "Hello",
"key2": "World",
"key3": 123
}