Reputation: 417
We have a workflow implemented in java with Spring boot. On successful initiation of a workflow, we send an email to the approvers. The email functionality works asynchronously in the flow and this is implemented with spring's JavaMailSender and @Async. Now my requirement to send a reminder email after 7 business days post 1st email if the workflow is still not approved.
I was going through spring boot documents and found that we can run scheduled task with @Schedule annotation by properly implementing it. Please help me understand can I achieve this with spring boot task scheduler. If yes, how do I write cron expression to trigger rmail after 7 business day. If no, please help with some solution
Upvotes: 1
Views: 985
Reputation: 7521
It's better to store such tasks in persistent storage like DB, Redis, File system, etc, otherwise if your application gets restarted all pending scheduled tasks will be lost.
email_tasks
SQL table@Scheduled
every N minutes (N is up to you)Upvotes: 2