【发布时间】:2021-04-16 01:46:49
【问题描述】:
我有一个 Spring Boot Web 应用程序,我想通过批处理从 CSV 文件上传详细信息。文件可以从任何位置上传,我想一次限制处理 3 个作业。如果已经在处理 3 个文件,我们必须将该信息提供给 UI,如“已达到油门限制。过一段时间再试”。我怎么能做到这一点? 我当前的 flow.xml 是主从方法
<!-- partitioner job -->
<job id="partitionJob" xmlns="http://www.springframework.org/schema/batch">
<!-- master step -->
<step id="masterStep">
<partition step="slave" partitioner="partitioner">
<handler grid-size="1" task-executor="taskExecutor" />
</partition>
</step>
</job>
<!-- each thread will run this job, with different stepExecutionContext
values. -->
<step id="slave" xmlns="http://www.springframework.org/schema/batch">
<tasklet transaction-manager="transactionManager" throttle-limit="3">
<chunk reader="itemReader" processor="userItemProcessor" writer="itemWriter"
commit-interval="10" />
<listeners>
<listener ref="stepJobListener" />
</listeners>
</tasklet>
</step>
【问题讨论】:
标签: spring spring-boot spring-batch batch-processing