'trigger some event with message on specific time

How can I trigger some event at a specific time with some message?

Example: Someone scheduled a "Happy birthday" message on his friend's birthday at 12:00 am. So this birthday event should be triggered with a "Happy birthday" message on his birthday at 12:00 am.

The only solution I can come up with about how this work is a cron job that runs every min and checks the expired time and triggers that event.

But if we have a lot of events then querying every minute is not a good idea and it gives 1 minute error also.

So can we use any services like apache Kafka (but it does not schedule events at some specific time) to trigger events?



Solution 1:[1]

It seems like you want to create a distributed and fault tolerant job scheduler. Below are a few interesting reads over the web

https://leetcode.com/discuss/general-discussion/1082786/System-Design%3A-Designing-a-distributed-Job-Scheduler-or-Many-interesting-concepts-to-learn

https://towardsdatascience.com/ace-the-system-design-interview-job-scheduling-system-b25693817950

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Rahul Vaid