Results 1 to 2 of 2

Thread: How can the JobParameters be available for steps?

  1. #1
    Join Date
    Oct 2005
    Location
    Bergen, Norway
    Posts
    128

    Default How can the JobParameters be available for steps?

    Hi!

    I add some parameters in a JobParameters object when I launch my Jobs with org.springframework.batch.core.repository.support. JobRepositoryFactoryBean and org.springframework.batch.core.launch.support.Simp leJobLauncher.

    The job is a org.springframework.batch.core.job.SimpleJob with a single step.

    The step is a org.springframework.batch.core.step.item.SkipLimit StepFactoryBean
    which has a org.springframework.batch.item.database.DrivingQue ryItemReader which contains a custom KeyCollector.

    This keycollector needs to access the jobParameters in order to obtain some input data to be able to fetch they keys - hos can this be done as the execution context is missing these parameters (the jobparameters)?

  2. #2
    Join Date
    Dec 2006
    Posts
    1,061

    Default

    In 1.1.x, make your collector a StepExecutionListener, register it with the step, and call stepExecution.getJobParameters().

    In 2.0, simply wire in the property with #{jobParameter[parameter.name]}

Posting Permissions

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