best approach for Parallel threaded step in and multi step job spring batch -
i have job configuration this,
job (
step 1: read db (jdbc item reader + writer) keep list of items in job execution context step 2 take items (list) step 1 (from job context) , execute step 2 in multiple parallel processes
)
here code looks like,
<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>
my question here is,
do have other option other writing partitioner handler second-step, want know if there way other partitioning achieve parallel processing in second step list of items.
kindly suggest if there better way,
try using 1 of task executor implementations supported in spring
Comments
Post a Comment