FlatFileItemWriter generating file even on exception
I am working on spring batch job that does the conventional READ > PROCESS > WRITE file operation.
Below is the sample code of writer I am using.
Code:
<bean id="simBeqResponseFlatFileWriter" class="org.springframework.batch.item.file.FlatFileItemWriter">
<property name="resource" ref="fileWriteSystemResource"></property>
<property name="lineAggregator">
<bean class="org.springframework.batch.item.file.transform.PassThroughLineAggregator" />
</property>
</bean>
The requirement is such that on any exception being thrown, the file should not be generated at all. I am facing a issue where even on some exception thrown in the code, a blank file is getting generated.
Need some help in resolving the issue.