Announcement Announcement Module
Collapse
No announcement yet.
JobParameter setting question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JobParameter setting question

    Hi,

    I have been able to run the sample footballJob using the CommandLineJobRunner using the JobParameter argument like 'schedule.date(date)=2009/05/17'. If I want to run the same job repeatedly is there any other parameter value I can set to do so?

    Thanks

  • #2
    I just tried it using the JobParameter as 'job.run(long)=10' after finding the last job_execution_id value to be '9' in the batch_job_execution metadata table. Wondering if there is a easy way to find the next value and set this value dynamically or there is already a built-in capability in the framework to something similar?

    Thanks

    Comment


    • #3
      The capability you are describing can be found using the JobParametersIncrementer + JobOperator. Check out SkipSampleFunctionalTests for a demonstration.

      Comment


      • #4
        Thanks Garrette. I'll try it out.

        Comment


        • #5
          One other question. For the footballJob sample run. I was wondering if I could do the following changes to the footballJob.xml for a dynamic job id incrementer -
          Code:
          <job id="footballJob" incrementer="incrementer">
          
          ...
          
          <beans:bean id="incrementer" class="org.springframework.batch.sample.common.InfiniteLoopIncrementer"/>
          I guess your InfiniteLoopIncrementer creates a JobParameters object containing a "run.id" parameter. Now if it is possible to use the CommandLineJobRunner to run the footballJob using the JobParameter object from InfiniteLoopIncrementer then what would be CommandLineJobRunner arguments look like?

          Right now I have -
          Code:
          org/springframework/batch/sample/FootballJobFunctionalTests-context.xml footballJob job.run(long)=11
          Is there any other changes do I have to do for this footballJob runner the way I want to run?

          Thanks

          Comment

          Working...
          X