Hi,
In our application, text files within a folder are read using MultiResourceItemReader, and data is updated in a database.
everything is working fine for me but I am unable to achieve two things
1) Log the actual file name before and after it is processed
2) after the file is read, move it to an archive folder.
Below is my job configuration
With ItemReadListener, I get items within the files but not the path of the file read by the MRIR. I have tried different listener configurations but unable to get access to the file being processed to achieve my objectives. I know I have to write a tasklet to achieve the file archiving but unable to do so.Code:<job id="samplejob" xmlns="http://www.springframework.org/schema/batch"> <step id="processStep"> <tasklet> <chunk reader="multiResourceReader" writer="customItemWriter" processor="validatingItemProcessor" commit-interval="1" skip-limit="4"> <skippable-exception-classes> <include class="org.springframework.batch.item.file.FlatFileParseException" /> </skippable-exception-classes> <streams> <stream ref="errorItemWriter" /> </streams> </chunk> </tasklet> </step> </job> <bean id="multiResourceReader" class="org.springframework.batch.item.file.FlatFileParseException" scope="step"> <property name="resources" value="#{jobParameters[fileInputPath]}" /> <property name="delegate" ref="flatFileItemReader" /> </bean> <!-- flatFileItemReader is a simple reader reading delimited text and we have a custom writer to update multiple tables. -->
Any hints in this regard would be of great help to me.
And i should admit, spring batch is cool...
Thanks in advance



Reply With Quote
