Results 1 to 2 of 2

Thread: Dynamic Scheduling of Jobs

Hybrid View

  1. #1
    Join Date
    May 2012
    Posts
    8

    Default Dynamic Scheduling of Jobs

    How can one schedule jobs using Quartz 1.8.6 Job Scheduler + Spring Batch 2.1 using the scheduling parameters provided, say, in a simple HTML form? I actually want this: "the user enters the scheduling time for job in a form, clicks submit, then the job gets executed at the specified time". I am currently using Cron Expressions. My XML Snippet is as follows:

    <bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronT riggerBean">
    <property name="jobDetail" ref="jobDetail"/>
    <property name="cronExpression" value="* 43 18 ? * *"/>
    </bean>

    Using this approach, the scheduling parameters are hard-coded. I dont want that. Please help!

  2. #2
    Join Date
    May 2012
    Posts
    8

    Default

    I got it!,,,
    used java Configuration

    @Configuration
    public class CustomCronExpression{

    //,......
    @Bean
    public String constructCronExpression(HttpServletRequest request) {
    String cronExpression = ....; //Contruct Cron Expression from the request
    return "cronExpression ";
    }
    //.....
    }

    Finally my batch config file will look the following:

    <bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronT riggerBean">
    <property name="jobDetail" ref="jobDetail"/>
    <property name="cronExpression" ref="constructCronExpression"/>
    </bean>

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •