I have been checking all over to find out how to configure a schedule for Spring Batch. I am using Spring boot with a web ui. The user can go and select a time to run a job and this must be persistence to a database and run when the time comes. A different user can schedule the same job for a different time. Does spring batch have anything similar to this? If not then what is the best way to go about this? need some examples.
0
votes
1 Answers
1
votes
There are no out of the box solution which just work. You can do this with minimal coding. Try to persist the schedule in database and on start up your application you can read all the schedule and schedule using batch scheduler. Also you can do the same thing when user enter new schedule with out restart.
Cron based scheduler is already available in spring. Just need to persist and schedule from your side.
scheduler.schedule(task, new CronTrigger("* 15 9-17 * * MON-FRI"));
documentation on scheduler is given here