简体   繁体   中英

Spring Batch Multiple Job execution

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>

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM