Announcement Announcement Module
Collapse
No announcement yet.
how to run same batch job with same params twice Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to run same batch job with same params twice

    I have a batch job which has the name of the file that is going to be processed as a late binding parameter. I want to process the file through spring batch twice. (this is a business requirement, dont ask me why please).

    The first time the file is processed with a exit code of completed. The second time the file is processed i get the exception

    org.springframework.batch.core.repository.JobInsta nceAlreadyCompleteException: A job instance already exists and is complete for parameters={input.file.name=classpath:TestDefects. csv}. If you want to run this job again, change the parameters.

    So is there a configuration change that can be made which will allow the file to be processed twice without having to change the input params.

    Thanks in advance

  • #2
    Nope, you'll have to pass a param because the "identity" of a job instance is the parameters for which it was called. Typically we'll include the current date/time in this case if we don't have some sort of business value that could be used.

    Comment


    • #3
      I am new to SB, but my 2 cents.
      Just add an extra random parameter like a=1 and you can run that same job with those parameters again.

      Comment

      Working...
      X