【发布时间】:2014-08-18 23:10:11
【问题描述】:
我有一个这样的作业配置,
工作(
Step 1: Read from DB (JDBC Item Reader + Writer)
Keep the list of items in Job Execution Context
Step 2 Take Items (list) from Step 1 (from Job Context)
and execute this Step 2 in multiple parallel processes
)
这是代码的样子,
<bean id="webServiceReader" class="org.springframework.batch.item.adapter.ItemReaderAdapter" scope="step">
<property name="targetObject" ref="individualXXXXService"/>
<property name="targetMethod" value="execute"/>
<property name="arguments">
<list>
<value type="java.util.List">#{jobExecutionContext['JDBC_ITEMS']}</value>
</list>
</property>
</bean>
<batch:job id="identityCpiIborSync" restartable="true">
<batch:step id="fetchCustomers" next="fetchDatabase">
<batch:tasklet>
<batch:chunk reader="dbItemReader" writer="dbItemWriter" commit-interval="500"/>
</batch:tasklet>
<batch:listeners>
<batch:listener ref="stepScopeExecutionListener"/>
</batch:listeners>
</batch:step>
<batch:step id="updateWS">
<!-- <batch:tasklet task-executor="taskExecutor" throttle-limit="10"> -->
<batch:tasklet>
<batch:chunk reader="webServiceReader" writer="cpiWSItemWriter" commit-interval="10"/>
</batch:tasklet>
</batch:step>
<batch:listeners>
<batch:listener ref="batchJobListener" />
</batch:listeners>
</batch:job>
我的问题是,
除了为第二步编写 Partitioner 处理程序之外,我还有其他选择吗?我只想知道除了分区之外是否还有其他方法可以在第二步中使用该项目列表实现并行处理。
如果有更好的方法,请提出建议,
【问题讨论】:
标签: spring spring-batch