I am developing a site where users will be able to run scheduled their own tasks. There will be a lot of tasks from each user.
Tasks can be of two types:
1. Tasks which will be run in the future at any time. (example: John want to post his message tomorrow in 5:25 pm).
2. Tasks which will be run in the future but in time which multiple 15 minutes. (example: John want to post his message tomorrow in 5:15 pm. He can't schedule this task on 5:25 because it isn't multiple 15 minutes. He can schedule it only on time like 5:15, 5:30, 5:45, 6:00 and so on).
What is the best practice to work with these tasks?
I have this idea:
Use a mysql database to store all tasks with index on time. Run a scheduler which will pull a task which must run soon and after this task pull next and so on.
Best Regards, Alexandr
You can use this framework https://quartz-scheduler.org/
What is Quartz? Job Scheduling Library
Quartz is a richly featured, open source job scheduling library that can be integrated within virtually any Java application - from the smallest stand-alone application to the largest e-commerce system. Quartz can be used to create simple or complex schedules for executing tens, hundreds, or even tens-of-thousands of jobs; jobs whose tasks are defined as standard Java components that may execute virtually anything you may program them to do. The Quartz Scheduler includes many enterprise-class features, such as support for JTA transactions and clustering.