I'm trying to build a serverless async polling service that triggers an async data request, waits for it to finish (by trying periodically) and then polling the response once its ready.
Ideally, I would trigger the data request with Lambda and push an event for EventBridge to later be processed by another Lambda that queries the API to see if the reseponse is ready, and if not - push a new event to EventBridge to try again later. For that to work, I need a way to make EventBridge wait before it forwards the event onwards. I'm trying to come up with a solution that doesn't require Lambda idle time.
Is there a way to make EventBridge wait on an event before it is pushed onwards? Or alternatively to setup a one-time scheduled event?
Sounds like the newly announced EventBridge scheduled events would solve your problem! You could simply schedule your event for Date.now()
+ x seconds or similar.
Announcement blog post: https://aws.amazon.com/blogs/compute/introducing-amazon-eventbridge-scheduler/
AWS Docs: https://docs.aws.amazon.com/scheduler/latest/UserGuide/what-is-scheduler.html