occurrent icon indicating copy to clipboard operation
occurrent copied to clipboard

Implement "alarm clock" utility

Open johanhaleby opened this issue 3 years ago • 4 comments

An "alarm clock" would be a place to post stuff like "Notify me in 5 minutes that we need to escalate billing for this particular order". I.e. a message will be sent in 5 minutes and could be picked-up (by what)? "Order" in this case would contain all state needed to process the message.

johanhaleby avatar Sep 14 '20 10:09 johanhaleby

A nice thing with this is that you can use the "alarm clock" for many use cases where you would normally need a (cron) job. For example, instead of a specific job that checks if an order has not been paid in payment 5 days, when the "alarm clock" can notify in 5 days instead.

johanhaleby avatar Sep 14 '20 10:09 johanhaleby

Note that what we should persist to the AlarmClock is not commands or events, rather it should be a "Reminder". The alarm clock should then invoke a callback ((Reminder) -> Unit) that let's one convert the Reminder into a "command".

johanhaleby avatar Sep 14 '20 10:09 johanhaleby

Note that instead of writing something like this oneself, see https://github.com/johanhaleby/occurrent/issues/15. It would be good to have a utility such as "AlarmClock" or "Reminder" that wraps e.g. JobRunr and provides a level of indirection of dispatch and data.

johanhaleby avatar Oct 07 '20 08:10 johanhaleby

Maybe call it Deadline instead?

johanhaleby avatar Oct 18 '20 05:10 johanhaleby