Announcement Announcement Module
Collapse
No announcement yet.
Dynamic Scheduling of Jobs Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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>

    Comment

    Working...
    X