Results 1 to 2 of 2

Thread: [ quartz ] spring batch

  1. #1
    Join Date
    Dec 2008
    Posts
    3

    Default [ 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. #2
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    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.

Posting Permissions

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