Skip to content

Task 6 aws task - #5

Open
Javlon999 wants to merge 4 commits into
masterfrom
task-6-aws-task
Open

Javlon999 wants to merge 4 commits into
masterfrom
task-6-aws-task

Conversation

@Javlon999

Copy link
Copy Markdown
Owner

What was done?

Task 6.1 - SQS Queue + catalogBatchProcess Lambda

  • Created SQS queue catalogItemsQueue in ProductServiceStack
  • Created catalogBatchProcess Lambda triggered by SQS with batchSize: 5
  • Lambda iterates over SQS messages and saves products to DynamoDB (products and stocks tables)
  • Added IAM permissions for Lambda to interact with DynamoDB and SQS

Task 6.2 - Updated importFileParser

  • Updated importFileParser Lambda to send each CSV record to SQS queue
  • Removed CloudWatch logging of CSV records
  • File still moves from uploaded/ to parsed/ after processing

Task 6.3 - SNS Topic + Email Subscription

  • Created SNS topic createProductTopic in ProductServiceStack
  • Added email subscription to SNS topic
  • Updated catalogBatchProcess Lambda to publish to SNS topic after creating each product
  • Added IAM permissions for Lambda to publish to SNS topic

Additional

  • Merged Task 4 (DynamoDB) changes into Task 6 branch
  • Fixed Lambda bundling by installing esbuild
  • Updated ImportServiceStack to use NodejsFunction for proper TypeScript bundling
  • Passed catalogItemsQueue from ProductServiceStack to ImportServiceStack

Full Flow

  1. User uploads CSV file via presigned URL → S3 uploaded/ folder
  2. S3 triggers importFileParser Lambda
  3. importFileParser parses CSV and sends each record to SQS
  4. File moves from uploaded/ to parsed/
  5. SQS triggers catalogBatchProcess Lambda with batch of 5 messages
  6. catalogBatchProcess saves products to DynamoDB
  7. catalogBatchProcess publishes notification to SNS topic
  8. Email notification received ✅

Link to Product Service API

Link to Import Service API

Product CSV Schema

title,description,price,count
Gaming Laptop,High performance gaming laptop,1500,3
Wireless Mouse,Ergonomic wireless mouse,45,20
Mechanical Keyboard,RGB mechanical keyboard,120,15
USB Hub,7 port USB hub,35,10
Monitor Stand,Adjustable monitor stand,80,8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant