I have to include the count of records in the File Header and for the same I have declared a property "recordCount" in executionContextPromotionListener. I am setting the value for the property in the ItemReader implementation using the ExecutionContext.
But before the ItemReader is invoked, the Header Callback for the ItemWriter is invoked and the writeHeader(Writer) is executed. Also, I do not have access to the ExecutionContext object when the writeHeader(Writer) is executed.
Any suggestions, how I can pass the value from the reader to the FileHeaderWriterCallBack implementation?