Mar 16th, 2009, 12:12 AM
writeFooter not called
I have a CustomFlatFileItemWriter which extends FlatFileItemWriter and implements FlatFileFooterCallback.
My file gets created and all the contents gets written, except for my footer.
It seem to me as if my writeFooter method is not called at all.
Am I missing something?
Mar 16th, 2009, 02:06 AM
Did you remember to call setFooterCallback(this)?
Mar 16th, 2009, 02:11 AM
I have now since changed my implementation according to the delegate patterns as set out in the docs.
That is my CustomWriter now implements ItemWriter instead of extending FlatFileItemWriter.
I now have my FlatFileItemWriter as a delegate.
all is well execpt that I now get a writer must be open before it can be written to error.
I have implemented ItemStream and overridden the open method, but how do I actually open my delegate flatFileItemWriter to avoid this error?
Mar 16th, 2009, 09:43 AM
either have your composite writer's open() method call "delegate.open()", or configure the delegate itself to be a stream.
Mar 16th, 2009, 04:30 PM
You should register the delegate as a stream. Any readers or writers directly wired into a step will be auto-detected, but the framework has no way of knowing what 'transitive dependencies' of readers and writers may be using that are also ItemStreams.
Mar 17th, 2009, 12:43 AM
Thanks, did that and it worked like a charm