Reputation: 21320
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.
<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>
I am facing a issue where even on some exception thrown in the code, a blank file is getting generated.On any exception being thrown in the code, the file should not be generated at all.
Need some help in resolving the issue.
Upvotes: 0
Views: 2067
Reputation: 21320
I found the solution. There is a property of FaltFileItemWriter which needs to be used as follows
<property name="shouldDeleteIfEmpty" value="true"/>
Upvotes: 3