Hi,
In our project we have a requirement where we transfer files from a SFTP server to local and then process the files in batch program. To acheive this we are using spring integration.
We are able to transfer the file from SFTP to local but MultiResourceItemReader in the batch process complains about "No resource to Read"
I am able to execute the steps seperately(unit test) but not as integrated one.
Please let me know what I am missing.
<beans >
<context:component-scan base-package="com.isg" />
<task:executor id="task" pool-size="10" queue-capacity="100"
rejection-policy="CALLER_RUNS" />
<!-- Various Channel for various messages -->
<int: publish-subscribe-channel id="job-operator"
task-executor="task" />
<int: publish-subscribe-channel id="job-request"
task-executor="task" />
<int:logging-channel-adapter channel="job-operator" />
<int:channel id="receiveChannel" />
<bean id="sftpSessionFactory" class="org.springframework.integration.sftp.sessio n.DefaultSftpSessionFactory">
<property name="host" value="remoteServerValue"/>
<property name="port" value="22"/>
<property name="user" value="sftpuser"/>
<property name="password" value="sftppassword"/>
</bean>
<int-sftp:inbound-channel-adapter id="sftpInbondAdapter" channel="receiveChannel" session-factory="sftpSessionFactory"
local-directory="D:\file" remote-directory="/d09/testfeed/IN/test/"
auto-create-local-directory="true" delete-remote-files="false" filename-pattern="*.csv"
/>
<int: poller id="cronPoller" default="true" task-executor="task">
<int:cron-trigger expression="0 56 16 ? * *" />
</int: poller>
<int:service-activator input-channel="receiveChannel" output-channel="job-request">
<bean class="com.isg.integration.JoblaunchServiceActivat er" />
</int:service-activator>
<int:service-activator input-channel="job-request" output-channel="job-operator">
<bean
class="org.springframework.batch.integration.launc h.JobLaunchingMessageHandler">
<constructor-arg ref="jobLauncher" />
</bean>
</int:service-activator>
<job id="GFS_0685_IN_001" xmlns="http://www.springframework.org/schema/batch">
<step id="ProjectMaster">
<tasklet>
<chunk reader="projectMasterReader" processor="projectMasterItemProcessor"
writer="itemWriter" commit-interval="10" />
</tasklet>
</step>
</job>
<bean id="projectMultiResourceReader"
class="org.springframework.batch.item.file.MultiRe sourceItemReader" lazy-init="true" >
<property name="resources"
value="file:/fileInput/Test.csv" />
<property name="strict" value="true"></property>
<property name="delegate" ref="itemReader" />
</bean
<bean id="itemWriter" class="org.springframework.batch.item.database.Jpa ItemWriter">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
</beans>


:/fileInput/Test.csv" />
Reply With Quote