sbstjn / sqs-worker-serverless

Example for SQS Worker in AWS Lambda using Serverless
https://sbstjn.com/serverless-sqs-worker-with-aws-lambda.html
MIT License
177 stars 38 forks source link

Reduce worker costs when queue is empty #4

Open mattmeye opened 6 years ago

mattmeye commented 6 years ago

Hello,

actually the worker-function is also invoked when the queue is empty. I think it would be better to control the active field of the rate-rule depending on a cloudwatch alarm too.

Inital: Rate is deactivated Zero Messages => Deactive AWS::Events:Rule One or more Messages in the Queue => Activate AWS::Events:Rule

What do you think?

mattmeye commented 6 years ago

off topic: it is also possible to save the scale factor into the worker function env or as a tag to any resource. Then the config db is no longer needed

mattmeye commented 6 years ago

ok, actually aws lambda can be triggered directly via sqs queue, no workaround necessary