Reputation:
I would like to create a lambda function listening for a SQS queue.
My only concern is this : I need every item in the queue to wait that the previous one has been treated by the lambda function. I fear that every time a new event is pushed in the queue, lambda is executed without checking if a previous function is still running.
Is it possible to do so ?
Upvotes: 0
Views: 547
Reputation: 45846
There is no direct integration between Lambda and SQS. In other words, you can't add an SQS queue as an event source for a Lambda function. At least not yet.
You could still write a Lambda function that polls SQS and processes the messages from the queue. That function will only be able to run a maximum of 5 minutes but you could set up a CloudWatch scheduled event to run every 5 minutes to keep your Lambda function running.
There is no built-in coordination between Lambda functions so if you had two instances of your function running at the same time, they would both be reading from the queue independently and would have no idea what the other functions were doing.
Why is that coordination important to you?
Upvotes: 3