Hi Michael,
Please find the configs below:
applicationContext.Batch.Partition.Jobs.xml
Code:
<beans>
<import
resource="classpath:/META-INF/spring/applicationContext.Batch.Partition.Beans.xml" />
<import
resource="classpath:/META-INF/spring/applicationContext.Batch.Partition.Integration.xml" />
<job id="retrySample" xmlns="http://www.springframework.org/schema/batch">
<step id="step">
<partition step="step1" partitioner="partitioner">
<handler grid-size="2" task-executor="taskExecutor1" />
</partition>
</step>
</job>
<bean id="partitioner" class="org.springframework.batch.core.partition.support.MultiResourcePartitioner">
<property name="resources" value="file:/Users/anoop/SourceCode/spring_batch/spring-batch-2.1.9/test-batch-process/batch-drop/*.txt" />
</bean>
<bean id="taskExecutor1" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="5" />
<property name="maxPoolSize" value="5" />
</bean>
<step id="step1" xmlns="http://www.springframework.org/schema/batch">
<tasklet>
<chunk reader="reader" writer="wsWriter" commit-interval="50" />
</tasklet>
</step>
</beans>
applicationContext.Batch.Partition.Beans.xml:
Code:
<beans>
<import
resource="classpath:/META-INF/spring/applicationContext.Batch.Infrastructure.xml" />
<context:property-placeholder location="classpath:batch-postgres.properties" />
<task:executor id="tasks" queue-capacity="100"
rejection-policy="CALLER_RUNS" />
<bean id="reader" class="org.springframework.batch.item.file.FlatFileItemReader"
scope="step">
<property name="resource" value="#{stepExecutionContext[fileName]}" />
<property name="lineMapper">
<bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
<property name="lineTokenizer">
<bean
class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
<property name="names" value="externalId,amount,accountType,bankId" />
</bean>
</property>
<property name="fieldSetMapper">
<bean
class="com.test.batch.item.mapper.LowBalanceInformationAlertMapper" />
</property>
</bean>
</property>
</bean>
<bean class="org.springframework.batch.test.JobLauncherTestUtils"></bean>
<bean id="wsWriter" class="com.test.batch.item.writer.WebServiceItemWriter">
<property name="wsGateway" ref="lowBalInfoAlertGateway" />
</bean>
<bean id="jobLauncher"
class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository" />
</bean>
<bean id="jobLauncherHandler"
class="org.springframework.batch.integration.launch.JobLaunchingMessageHandler">
<constructor-arg ref="jobLauncher" />
</bean>
<bean id="fileMessageToJobRequest" class="com.test.batch.trigger.FileMessageToJobRequest">
<property name="job" ref="retrySample" />
<property name="fileParameterName" value="input.file.name" />
</bean>
<bean id="lowBalInfoFieldSetMapper"
class="com.test.batch.item.mapper.LowBalanceInformationAlertMapper">
</bean>
<bean id="baseWsTransformer"
class="com.test.batch.item.transformer.BaseWebServiceTransformer">
<property name="csrId" value="BOT_WS_USER" />
<property name="csrPassword" value="BOT_WS_PWD" />
<property name="systemId" value="BOT_WS_USER" />
<property name="systemPassword" value="BOT_WS_PWD" />
</bean>
<bean id="lowBalInfoAlertTransformer"
class="com.test.batch.item.transformer.LowBalanceInfoAlertTransformer"
parent="baseWsTransformer" />
</beans>
applicationContext.Batch.Partition.Integration.xml :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans >
<!--File polling -->
<channel id="files" />
<channel id="fileRequests" />
<!-- <channel id="nullChannel"> <queue capacity="10" /> </channel> -->
<int-file:inbound-channel-adapter
directory="/Users/anoop/SourceCode/spring_batch/spring-batch-2.1.9/test-batch-process/batch-drop"
channel="files" filename-pattern="*.txt">
<poller id="poller" fixed-delay="5000" />
</int-file:inbound-channel-adapter>
<transformer input-channel="files" output-channel="fileRequests"
ref="fileMessageToJobRequest" method="toRequest">
</transformer>
<service-activator method="launch" input-channel="fileRequests"
ref="jobLauncherHandler" output-channel="nullChannel">
</service-activator>
<!-- Send low bal conditional alert -->
<oxm:xmlbeans-marshaller id="xmlBeansMarshaller" />
<gateway id="lowBalInfoAlertGateway"
service-interface="com.test.batch.integration.gateway.WebServiceGateway"
default-request-channel="lowBalRequestChannel" />
<channel id="lowBalRequestChannel" />
<chain input-channel="lowBalRequestChannel" output-channel="lowBalRequestWSChannel">
<int-ws:header-enricher>
<int-ws:soap-action
value="http://schemas.clairmail.com/2007/06/wsdl/sendConditionalAlert" />
</int-ws:header-enricher>
<transformer ref="lowBalInfoAlertTransformer" method="transform"></transformer>
</chain>
<int-ws:outbound-gateway uri="http://localhost:8091/router"
request-channel="lowBalRequestWSChannel" marshaller="xmlBeansMarshaller"
unmarshaller="xmlBeansMarshaller" id="wsLowBalOutboundGateway">
</int-ws:outbound-gateway>
<channel id="lowBalRequestWSChannel" />
<channel id="lowBalRequestWSOutChannel" />
<service-activator input-channel="lowBalRequestWSOutChannel"
expression="payload"></service-activator>
<message-history />
</beans:beans>
I removed the namespace declarations in the xml file and masked some classes for brevity. Please let me know in case you need any further configuration information.