1

I am using a spring batch tasklet for batch processing and my scenario is to do the below process once in a day at say 11 PM in the night. The process are

Read a file and process

write the data to the DB

archive the file.

But when I execute the job, the job keeps on executing the first step in multiple threads and iam getting this error Could not execute the job succesfullyorg.springframework.batch.core.repository.JobExecutionAlreadyRunningException:

Is there any wat that I can configure in my job xml to execute the job only once for the schedule time.

<batch:job id="PullJob">


        <batch:step id="ProcessingStep" next="cleanStep">
            <batch:tasklet transaction-manager="transactionManager">
                <batch:chunk reader="fileReader" processor="processor" writer="dbWriter" commit-interval="30" />
            </batch:tasklet>
        </batch:step>

        <batch:step id="cleanStep">
            <tasklet ref="cleaningTasklet"/>
        </batch:step>

    </batch:job>
Cœur
  • 37,241
  • 25
  • 195
  • 267
sriramdev
  • 759
  • 1
  • 5
  • 11

1 Answers1

0

See this SO post. If you have no other parameters you can pass in the current date as a parameter to get unique job executions.

Community
  • 1
  • 1
leeor
  • 17,041
  • 6
  • 34
  • 60