Announcement Announcement Module
Collapse
No announcement yet.
[ quartz ] spring batch Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [ quartz ] spring batch

    Hello,

    How to schedule(quartz) job tier in spring batch(job, step, item)?

    Is someone have an example?

    I have:

    Code:
    <bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
      <property name="jobRepository" ref="jobRepository" />
      <property name="taskExecutor">
        <bean class="org.springframework.core.task.SimpleAsyncTaskExecutor" />
      </property>
    </bean>
    
    Also, a Quartz JobDetail is defined using a Spring JobDetailBean as a convenience.
    
    <bean id="jobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
        <property name="jobClass" value="org.springframework.batch.sample.quartz.JobLauncherDetails" />
        <property name="group" value="quartz-batch" />
        <property name="jobDataAsMap">
            <map>
                <entry key="jobName" value="footballJob"/>
                <entry key="jobLocator" value-ref="jobRegistry"/>
                <entry key="jobLauncher" value-ref="jobLauncher"/>
            </map>
        </property>
    </bean>
    
    Finally, a trigger with a scheduler is defined that will launch the job detail every 10 seconds:
    
    <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
      <property name="triggers">
        <bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
          <property name="jobDetail" ref="jobDetail" />
          <property name="cronExpression" value="0/10 * * * * ?" />
        </bean>
      </property>
    </bean>
    I don't how to use org.springframework.batch.core.job.SimpleJob with this quartz conf?



    Thanks

  • #2
    Your "footballJob" is a Job (probably therefore a SimpleJob). Configure it to do whatever you need. The code you posted is from the Spring Batch samples, by the way, so you can see it working there.

    Comment

    Working...
    X