-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathindex.js
More file actions
30 lines (23 loc) · 850 Bytes
/
index.js
File metadata and controls
30 lines (23 loc) · 850 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
// Second Lambda function in the sequence
export const handler = async (event) => {
console.log('Notification Service invoked with:', JSON.stringify(event, null, 2));
const { executionId, triggerTime, previousStepResult, task } = event;
// Simulate sending notifications
const notificationsSent = Math.floor(Math.random() * 10) + 1;
await new Promise(resolve => setTimeout(resolve, 1000)); // Simulate notification time
const result = {
functionName: 'NotificationServiceFunction',
executionId,
triggerTime,
task,
notificationsSent,
recipientCount: notificationsSent,
previousStepSummary: {
recordsProcessed: previousStepResult.recordsProcessed
},
status: 'success',
notifiedAt: new Date().toISOString()
};
console.log('Notifications sent:', result);
return result;
};