Hello,
I'm facing a strange problem with FlatFileItemWriter. The written lines are not sorted in the output file. The last invalid line is not at the bottom of my output file.
This writer is called by a SkipListener to log invalid lines while reading from an input file using flatFileReader.
This is my config :
But if I set commit-interval to '1' the problem disappear !! but for performance raisons I can not keep this value.Code:<batch:job id="myJob"> <batch:listeners> <batch:listener ref="appJobExecutionListener" /> </batch:listeners> <batch:step id="step1"> <batch:tasklet> <batch:listeners> <batch:listener ref="mySkipListener" /> </batch:listeners> <batch:chunk reader="flatFileReader" writer="itemWriter" processor="compositeItemProcessor" commit-interval="${my.commit.interval}" skip-limit="${my.skip.limit}" retry-limit="${my.retry.limit}"> <batch:skippable-exception-classes> <batch:include class="org.springframework.batch.item.file.FlatFileParseException" /> <batch:include class="org.springframework.batch.item.validator.ValidationException" /> </batch:skippable-exception-classes> <batch:streams> <batch:stream ref="errorWriter" /> </batch:streams> </batch:chunk> </batch:tasklet> </batch:step> </batch:job> <bean id="myLineAggregator" class="com.xm.auth.batch.my.MyLineAggregator" /> <bean id="errorWriter" class="org.springframework.batch.item.file.FlatFileItemWriter"> <property name="resource" value="${my.error.file.location}" /> <property name="lineAggregator" ref="myLineAggregator" /> </bean>
I'm missing any configuration ?
Thanks in advance.


Reply With Quote