In my use case my itemWriter will write an XML to the filesystem, after which I want to insert the representation in a table.
public CompositeItemWriter<T> compositeItemWriter(){
CompositeItemWriter writer = new CompositeItemWriter();
writer.setDelegates(Arrays.asList(fileWriter(), dbWriter()));
return writer;
}
If an object from the stream isn't properly saved to the file, it is ok to skip it using a skip policy, and I will probably save the failed objects somewhere in the form of a log.
However it is mandatory that the dbWriter does not write this entity to the db in case it happens.
So how can we use the composite writer to skip the second itemwriter in case the first one fails?