'Debounce Events in Cloud

I am looking for a good cloud solution to handle below scenario, where I need to wait for future events within a specific time interval to know whether to process current event. Its kindoff like Debounce (“group” multiple sequential calls within a time period in a single one) but little more complex as the timer needs to be reset when next event is received.

Eg: I get a request of Event A at X time for a particular User(U1).

a. If I get a similar Event A from same User within 5mins of X time, I need to reset the timer and keep watching again.

b. If 5 mins have passed by, I need to process Event A.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source