Results 1 to 3 of 3

Thread: how to run same batch job with same params twice

  1. #1

    Default 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. #2
    Join Date
    Mar 2006
    Posts
    312

    Default

    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.

  3. #3

    Default

    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.

Posting Permissions

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