Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
//------------------------------------------------------------
// Document processor (Router to Sync/Async Pipeline)
const documentProcessor = new lambda.Function(this, 'TaskProcessor', {
runtime: lambda.Runtime.Python37,
code: lambda.Code.asset('lambda/documentprocessor'),
handler: 'lambda_function.lambda_handler',
environment: {
SYNC_QUEUE_URL: syncJobsQueue.queueUrl,
ASYNC_QUEUE_URL: asyncJobsQueue.queueUrl
}
});
//Layer
documentProcessor.addLayer(helperLayer)
//Trigger
documentProcessor.addEventSource(new DynamoEventSource(documentsTable, {
startingPosition: lambda.StartingPosition.TrimHorizon
}));
//Permissions
documentsTable.grantReadWriteData(documentProcessor)
syncJobsQueue.grantSendMessages(documentProcessor)
asyncJobsQueue.grantSendMessages(documentProcessor)
//------------------------------------------------------------
// Sync Jobs Processor (Process jobs using sync APIs)
const syncProcessor = new lambda.Function(this, 'SyncProcessor', {
runtime: lambda.Runtime.Python37,
code: lambda.Code.asset('lambda/syncprocessor'),
handler: 'lambda_function.lambda_handler',
reservedConcurrentExecutions: 1,