Description
My issue is explained in detail in Stackoverflow here
Expected Behavior
I use a LineCallbackHandler
to skip header lines in my file. I need to know which file resource the handler is currently skipping lines for. This used to be able to be achieved through MultiResourceItemReader.getCurrentResource()
but this directly couples the MultiResourceItemReader
to the LineCallbackHandler
and recently that method has been deprecated.
Current Behavior
As suggested by @fmbenhassine in the Stackoverflow question there is a way to get this information by directly coupling the FlatFileItemReader
itself to the LineCallbackHandler
but this is just a workaround that essentially replicates the coupling in a different place.
As confirmed by @fmbenhassine Spring Batch offers no out of the box way to implement what I am trying to achieve without coupling.
An approach suggested by @fmbenhassine is to create a new interface ResourceAwareLineCallbackHandler
that the FlatFileItemReader
can make use of.
As also suggested by @fmbenhassine there may be other use cases for what I am trying to achieve such as lines considered as comment and knowing the source file of each comment line
This feature request is to discuss different options for implementing desired behaviour.