Skip to content

Commit 230fc38

Browse files
committed
feat: Implement Lambda consumer stub
1 parent e9225c5 commit 230fc38

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

lambda/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export const handler = async () => {
2+
// Implement your event processing code here.
3+
4+
return {
5+
statusCode: 200,
6+
body: JSON.stringify({
7+
message: 'Hello World!'
8+
})
9+
}
10+
11+
}

lib/eventConsumer.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,18 @@ export class EventConsumer extends Construct {
4646
alarmDescription: 'Messages are getting old in the queue'
4747
});
4848

49-
/* Uncomment the following code block to add Lambda functions to process items from the Queue
50-
// CDK code for observable Lambda function
49+
// CDK code for observable Lambda consumer
5150
const processingFunction = new aws_lambda.Function(this, 'EventProcessingFunction', {
5251
runtime: aws_lambda.Runtime.NODEJS_22_X,
5352
handler: 'index.handler',
5453
code: aws_lambda.Code.fromAsset('lambda'),
5554
tracing: aws_lambda.Tracing.ACTIVE, // Enable X-Ray tracing
5655
environment: {
57-
LOG_LEVEL: 'INFO',
58-
METRICS_NAMESPACE: 'EventProcessing'
56+
LOG_LEVEL: 'INFO',
57+
METRICS_NAMESPACE: 'EventProcessing'
5958
}
6059
});
61-
60+
6261
// Grant permissions for CloudWatch metrics
6362
processingFunction.addToRolePolicy(new aws_iam.PolicyStatement({
6463
actions: ['cloudwatch:PutMetricData'],
@@ -70,6 +69,5 @@ export class EventConsumer extends Construct {
7069
processingFunction.addEventSourceMapping('EventSourceMapping', {
7170
eventSourceArn: this.queue.queueArn
7271
});
73-
*/
7472
}
7573
}

0 commit comments

Comments
 (0)