Hi,
I am newbie with spring batch. I am using Spring Batch 2.1.3 in my current project. I have use <split></split> to rum two parallel steps in job.
But when I saw output of job, Steps are running in sequential manner (one after other)
My helloWorldJob.xml is
and DB-JOBREPOSITORY.xml isCode:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:batch="http://www.springframework.org/schema/batch" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> <import resource="DB-JOBREPOSITORY.xml"/> <bean id="hello" class="PrintTasklet"> <property name="message" value="Hello"/> </bean> <bean id="world" class="PrintTasklet"> <property name="message" value=" World!"/> </bean> <bean id="dynamicJobParameters" class="DynamicJobParameters" /> <batch:job id="helloWorldJob" incrementer="dynamicJobParameters"> <batch:split id="main" > <batch:flow> <batch:step id="step0" > <batch:tasklet ref="hello" transaction-manager="jobRepository-transactionManager" /> </batch:step> </batch:flow> <batch:flow> <batch:step id="step1"> <batch:tasklet ref="world" transaction-manager="jobRepository-transactionManager" /> </batch:step> </batch:flow> </batch:split> </batch:job> </beans>
output of my sample projectCode:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="jobRepository-dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.ibm.db2.jcc.DB2Driver" /> <property name="url" value="database" /> <property name="username" value="username" /> <property name="password" value="pasword" /> </bean> <bean id="jobRepository-transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" lazy-init="true"> <property name="dataSource" ref="jobRepository-dataSource" /> </bean> <bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean"> <property name="dataSource" ref="jobRepository-dataSource" /> <property name="transactionManager" ref="jobRepository-transactionManager"/> <property name="databaseType" value="db2" /> <property name="tablePrefix" value="BATCH_"/> </bean> <bean id="asyncTaskExecutor" class="org.springframework.core.task.SimpleAsyncTaskExecutor"/> <bean id="syncTaskExecutor" class="org.springframework.core.task.SyncTaskExecutor" /> <bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"> <property name="jobRepository" ref="jobRepository"/> </bean> <bean id="jobExplorer" class="org.springframework.batch.core.explore.support.JobExplorerFactoryBean" p:dataSource-ref="jobRepository-dataSource" p:tablePrefix="batch_" /> </beans>
Please suggest.Code:Hello Hello Hello Hello Hello World! World! World! World! World!
Thanks,


Reply With Quote
