Spring Batch Integration and FileToJobLaunchRequestAdapter
Hi guys,
I'm trying to start a job from a file read and I running into some issues.
First of all, even tho I added the Spring Batch Integration jar to the pom file, my xml can't find the FileToJobLaunchRequestAdapter class when I try to run it:
Code:
Cannot find class [org.springframework.batch.admin.integration.FileToJobLaunchRequestAdapter]
My job config looks like below.
Which seems pretty bloated to me. Are all these steps necessary?
Code:
<int:channel id="fileNameForJob" />
<int:service-activator id="jobStarter" input-channel="fileNameForJob" output-channel="jobLaunchRequestGen">
<bean class="org.springframework.batch.admin.integration.FileToJobLaunchRequestAdapter">
<property name="job" ref="companyLoadJob" />
</bean>
</int:service-activator>
<int:channel id="jobLaunchRequestGen" />
<int:service-activator input-channel="jobLaunchRequestGen">
<bean class="org.springframework.batch.integration.launch.JobLaunchingMessageHandler">
<constructor-arg ref="jobLauncher" />
</bean>
</int:service-activator>
<bean id="jobLauncher"
class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository" />
</bean>
<batch:job id="companyLoadJob" job-repository="jobRepository" >
<batch:step id="companyLoad" >
<batch:tasklet>
<batch:chunk reader="companyFileItemReader" writer="companyWriter" commit-interval="5" />
</batch:tasklet>
</batch:step>
</batch:job>
Finally, the reader defined above (it's a org.springframework.batch.item.file.FlatFileItemRe ader) I got from the batch samples and takes a property called resource which at the moment is hardcoded. How can I make this the dynamically passed filename?
Code:
<property name="resource" value="C:\blahblah\company.txt" />
Thanks for any help,
Cheers,
Tony