Results 1 to 4 of 4

Thread: Dynamically setting commit-interval

  1. #1

    Default Dynamically setting commit-interval

    We have a scenario where the commit-interval is being set for each job by the admin. The value is stored in database. How can we set the commit-interval value for the chunk ,dynamically and not by specifying it in the xml (configuration).

  2. #2
    Join Date
    Dec 2005
    Location
    Lyon, France
    Posts
    311

    Default

    I guess you can refer to job parameters when setting up the commit interval. Try with the usual #{jobParameters['my.key']} syntax and you would be able to specify the commit when launching the job.

  3. #3
    Join Date
    Sep 2008
    Location
    Chicagoland, IL
    Posts
    366

    Default

    You can either use parameters (as noted by @arno) or you could create a custom CompletionPolicy that either reads from that database as you mentioned or accepts the parameters.
    Michael Minella
    Spring Batch Lead
    Author - Pro Spring Batch
    http://www.michaelminella.com
    Twitter: @MichaelMinella

  4. #4
    Join Date
    Dec 2005
    Location
    Lyon, France
    Posts
    311

    Default

    The job parameters solution is straightforward but it impacts the identity of the job instance, thus restartability. The dynamic completion policy solution is more difficult to set up, but more elegant I guess.

Tags for this Thread

Posting Permissions

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