繁体   English   中英

Spring Batch多个作业执行

[英]Spring Batch Multiple Job execution

我正在使用Spring Batch Tasklet进行批处理,我的情况是每天晚上晚上11点执行一次以下过程。 该过程是

读取文件并处理

将数据写入数据库

存档文件。

但是,当我执行该作业时,该作业会继续在多个线程中执行第一步,并且会出现此错误。无法成功执行该作业org.springframework.batch.core.repository.JobExecutionAlreadyRunningException:

我可以在我的作业xml中配置任何wat,以在计划时间内仅执行一次作业。

<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>

请参阅此SO帖子。 如果没有其他参数,则可以传入当前日期作为参数以获取唯一的作业执行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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