How to run @Scheduled n times, based on number of companies I have in application? For example method sendMail should run every day but in different time for every company I have in application.
Run method every day at X(based on information from database) for company A (based on information from database)
@Scheduled(cron="#{@getCronValue}") public void sendMail() {... send mail for company A }
Run method every day at Y(based on information from database) for company B (based on information from database)
N. Run n times (number of companies)
I don't think that @Scheduled is a direct solution to your problem. I would recommend the following approach:
You could use existing solutions like https://github.com/kagkarlsson/db-scheduler or Quartz Scheduler for this as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.