Reputation: 75
I am working on a project which has a table "Games" with columns ID, Name, Start-time, End-time. Whenever an item is added to the table, and the end-time is reached, I want to trigger an event (SNS notification, but I can work my way around with anything else). The current implementation polls the table to check what "games" have expired and generates the event. Is there a technique to avoid polling, like SQSs, SWFs which I can use. The problem with the current approach is the polling the DB is costing me too much money since the complete infra is on cloud.
Upvotes: 0
Views: 577
Reputation: 13025
AWS DynamoDB is a perfect suit for this. You can set the record to Auto-Expire with a TTL attribute and the record will be removed.
If you want to extend the time of auto expiry, you can update the ttl attribute of the record and it will get extended.
Time to Live on DynamoDB:
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/TTL.html
You can configure a lambda to capture the deleted record and do whatever you want to do from there.
DynamoDB Streams:
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.html
It is all event-based and zero polling.
Hope it helps.
Upvotes: 1