【问题标题】:Spring Batch Multiple Job executionSpring Batch 多个作业执行
【发布时间】:2014-12-10 14:22:50
【问题描述】:

我正在使用 spring 批处理 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>

【问题讨论】:

    标签: java spring spring-batch batch-processing tasklet


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2012-06-12
      • 2020-06-03
      • 2019-11-21
      • 1970-01-01
      • 2020-02-25
      • 1970-01-01
      • 2016-03-16
      • 1970-01-01
      • 2015-11-25
      相关资源
      最近更新 更多