Dynamic scheduling of tasks with spring batch + Quartz

Asked

Viewed 621 times

8

I have a project in Spring Batch + Quartz, which loads a file and then processes the data from the file. Only that I wanted to implement a view with a form where I had the option to choose the start time and the end time and the days where I could run. I can do this with Quartz + Spring batch ?

Thank you for your attention

2 answers

1

Yes, the Spring Scheduler commands can be programmatically adjusted. More details here

Just persist your view data and create a new one CronTrigger with the execution data.

  • hm ok, thanks for the tip. I’ll investigate :)

0

Hello! The latest versions of Spring allow you to create a method and schedule its execution with a Cron annotation. For this just follow a few tips. Let’s go to them:

@Component
class Agendador {
  //Tarefa agendada para todos os dias a 00:00
  @Scheduled(cron="0 0 0 * * *")
  public void tarefaAgendada() {
    //Codigo da sua tarefa
  }
}

This should surely solve your problem!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.