Say I have a messaging application. Every minute I want the application to send push notifications if any message is one minute old. Currently, I'm thinking of having a lambda function being called every minute, but since I'm probably not going to have a push notification to send every minute, I was wondering if it was possible to schedule a lambda function to run in the future whenever a message is added to the system.
Basically, it would work like this:
- Message arrives to system.
- Is a lambda function scheduled to notify of stale messages?
- If no, schedule lambda function
- If yes, do nothing
- When lambda has executed, check if there are more messages in system that haven't gone stale yet.
- If yes, schedule lambda function.